Skip to content

Instantly share code, notes, and snippets.

@choomz
choomz / collection_widget.twig
Created August 5, 2012 22:21 — forked from cowlby/collection_widget.twig
Customizing form collections in Symfony2
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
<div class="grid_4">
<div class="da-panel">
<div class="da-panel-header">
<span class="da-panel-title">
<img src="{{ asset('bundles/vlabslpapadmin/images/icons/black/16/list.png') }}" />
{{ block('title') }}
</span>
</div>
<div class="da-panel-toolbar top">
{{ block('toolbar') }}
<?php
function utf8_urldecode($str) {
$str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
return html_entity_decode($str,null,'UTF-8');;
}
// Main
$options = getopt('de');
services:
twig.extension.text:
class: Twig_Extensions_Extension_Text
tags:
- { name: twig.extension }
twig.extension.debug:
class: Twig_Extensions_Extension_Debug
tags:
- { name: twig.extension }
vim /etc/init.d/firewall
#!/bin/bash
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Vlabs\MediaBundle\Form\Type\FileType;
use Vlabs\MediaBundle\Handler\MediaHandlerInterface;
class TypeExtensionTest extends CoreExtension
{
private $handler;
public function __construct(MediaHandlerInterface $handler)
{
@choomz
choomz / interface
Created November 5, 2012 08:38
Adapter media bundle
<?php
namespace Vlabs\MediaBundle\Adapter;
use Doctrine\Common\EventArgs;
interface AdapterInterface
{
/**
* Gets the mapped object from the event arguments.
@choomz
choomz / gist:4077639
Created November 15, 2012 09:31
FiltType
<?php
namespace Vlabs\MediaBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Vlabs\MediaBundle\Form\DataTransformer\BaseFileToStringTransformer;
@choomz
choomz / gist:4361766
Created December 22, 2012 23:18 — forked from reel/gist:1638094
<?php
/*
* This class will give us a simple interface to interact with Datatables
*
* Meant to work with Datatables v1.9
*
* DO NOT FORGET TO ADD A GET() METHOD TO YOUR ENTITIES...
*
@choomz
choomz / gist:4361768
Created December 22, 2012 23:19 — forked from reel/gist:1638095
<?php
/*
* This class will give us a simple interface to interact with Datatables
*
* Meant to work with Datatables v1.9
*
* DO NOT FORGET TO ADD A GET() METHOD TO YOUR ENTITIES...
*