Skip to content

Instantly share code, notes, and snippets.

View j's full-sized avatar

Jordan Stout j

View GitHub Profile
<?php
namespace ZGOffers\MainBundle\Form;
use Symfony\Component\Form\AbstractType,
Symfony\Component\Form\FormBuilder;
class CreativeQuestionsType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
<?php
namespace JStout\MainBundle\Form;
use Symfony\Component\Form\AbstractType,
Symfony\Component\Form\FormBuilder;
class CreativeQuestionsType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
<div class="form-box">
<h2>Creative Panel for {{ offer.getName }}</h2>
<form {% if edit == true %}class="dontHide"{% endif %} style="display: block;" action="{{ postUrl }}" method="post" novalidate="novalidate">
{{ form_errors(form) }}
{{ form_row(form.name) }}
{{ form_row(form.title) }}
{{ form_row(form.description) }}
{{ form_row(form.body) }}
{{ form_row(form.script) }}
<div>
<?php
namespace JStout\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="offer")
*/
@j
j / gist:1081388
Created July 13, 2011 21:34
Collection Prototypes
<form action="{{ path('form_submit') }}" method="post">
{{ form_errors(form) }}
{{ form_rest(form) }}
<input type="submit" value="Save" />
</form>
{{ form_protypes(form) }}
would render something like:
<form action="/form-submit" method="post">
@j
j / Rand.php
Created July 19, 2011 18:06
Controller.php
<?php
namespace JStout\MainBundle\Component\Doctrine\DQL;
use Doctrine\Common\Lexer;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
/**
* RandFunction ::= "RAND" "(" ")"
$('div.collection div.add a').click(function() {
var $parent = $(this).parent().parent(), $prototype = $parent.find('div:first div:last'), html;
html = $prototype.attr('data-prototype').replace(/\$\$name\$\$/g, $parent.find('div:first > div:not(:last)').length);
$prototype.before(html);
return false;
});
{% block _advanced_parameters_row %}
{% spaceless %}
<div class="collection">
<label>Parameters</label>
<div style="float: left; clear: none">
{% for name, child in form %}
{% if name is not sameas('$$name$$') %}
<div class="collection_item">
<span class="field">{{ form_widget(child.field) }}</span>
<span class="type">{{ form_widget(child.parameter) }}</span>
{% block _path_zones_row %}
{% spaceless %}
<div class="collection">
<ul id="sortable">
{% for name, child in form %}
{% if name is not sameas('$$name$$') %}
<li class="collection_item">
{{ form_widget(child) }}
<div class="remove">
<label>&nbsp;</label>
# Initial Script Call
<script type="text/javascript">
var cache_buster = Math.floor(Math.random()*9999999);
var zpix = document.createElement('script');
zpix.type = 'text/javascript';
zpix.async = true;
zpix.src = (document.location.protocol == 'https:' ? 'https://192.168.1.90/pixel/3.js' : 'http://192.168.1.90/pixel/3.js');
document.getElementsByTagName('body')[0].appendChild(zpix);
</script>