Skip to content

Instantly share code, notes, and snippets.

View bshaffer's full-sized avatar

Brent Shaffer bshaffer

View GitHub Profile
<?php
/**
* sf_guard_user_old module configuration.
*
* @package ##PROJECT_NAME##
* @subpackage sf_guard_user_old
* @author ##AUTHOR_NAME##
* @version SVN: $Id: helper.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
*/
<?php
/**
* sf_guard_user_old module configuration.
*
* @package ##PROJECT_NAME##
* @subpackage sf_guard_user_old
* @author ##AUTHOR_NAME##
* @version SVN: $Id: configuration.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
*/
@bshaffer
bshaffer / actions
Created April 13, 2011 05:58
Old Admin: from actions.class.php - batchAction
<?php
abstract class autoSf_guard_user_oldActions extends sfActions
{
// ....
public function executeBatch(sfWebRequest $request)
{
$request->checkCSRFProtection();
if (!$ids = $request->getParameter('ids'))
@bshaffer
bshaffer / gist:917042
Created April 13, 2011 05:58
Hadori: from actions.class.php - processForm function
<?php
abstract class autoSf_guard_user_oldActions extends sfActions
{
// ....
protected function processForm(sfForm $form)
{
$form->bind($this->getRequest()->getParameter($form->getName()), $this->getRequest()->getFiles($form->getName()));
if ($form->isValid())
@bshaffer
bshaffer / gist:917036
Created April 13, 2011 05:54
Hadori: from actions.class.php...
<?php
abstract class autoSf_guard_user_oldActions extends sfActions
{
// ....
public function executeBatch(sfWebRequest $request)
{
if (!$ids = $request->getParameter('ids'))
{
$this->getUser()->setFlash('error', 'You must at least select one item.');
<ul class="sf_admin_actions">
<?php if ($form->isNew()): ?>
<?php echo $helper->linkToDelete($form->getObject(), array( 'params' => array( ), 'confirm' => 'Are you sure?', 'class_suffix' => 'delete', 'label' => 'Delete',)) ?>
<?php echo $helper->linkToList(array( 'params' => array( ), 'class_suffix' => 'list', 'label' => 'Back to list',)) ?>
<?php echo $helper->linkToSave($form->getObject(), array( 'params' => array( ), 'class_suffix' => 'save', 'label' => 'Save',)) ?>
<?php echo $helper->linkToSaveAndAdd($form->getObject(), array( 'params' => array( ), 'class_suffix' => 'save_and_add', 'label' => 'Save and add',)) ?>
<?php else: ?>
<?php echo $helper->linkToDelete($form->getObject(), array( 'params' => array( ), 'confirm' => 'Are you sure?', 'class_suffix' => 'delete', 'label' => 'Delete',)) ?>
<?php echo $helper->linkToList(array( 'params' => array( ), 'class_suffix' => 'list', 'label' => 'Back to list',)) ?>
<?php echo $helper->linkToSave($form->getObject
<?php if ($field->isPartial()): ?>
<?php include_partial('sf_guard_user_old/'.$name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?>
<?php elseif ($field->isComponent()): ?>
<?php include_component('sf_guard_user_old', $name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?>
<?php else: ?>
<div class="<?php echo $class ?><?php $form[$name]->hasError() and print ' errors' ?>">
<?php echo $form[$name]->renderError() ?>
<div>
<?php echo $form[$name]->renderLabel($label) ?>
<fieldset id="sf_fieldset_<?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?>">
<?php if ('NONE' != $fieldset): ?>
<h2><?php echo __($fieldset, array(), 'messages') ?></h2>
<?php endif; ?>
<?php foreach ($fields as $name => $field): ?>
<?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?>
<?php include_partial('sf_guard_user_old/form_field', array(
'name' => $name,
'attributes' => $field->getConfig('attributes', array()),
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<div class="sf_admin_form">
<?php echo form_tag_for($form, '@sf_guard_user_sf_guard_user_old') ?>
<?php echo $form->renderHiddenFields(false) ?>
<?php if ($form->hasGlobalErrors()): ?>
<?php echo $form->renderGlobalErrors() ?>
<?php endif; ?>
@bshaffer
bshaffer / _form.php
Created April 13, 2011 05:39
_form.php
<?php include_javascripts_for_form($form) ?>
<?php include_stylesheets_for_form($form) ?>
<div class="admin-form">
<?php echo form_tag_for($form, '@sf_guard_user') ?>
<?php echo $form->renderGlobalErrors() ?>
<?php echo $form->renderHiddenFields() ?>
<div class="form-element input_text">
<?php echo $form['first_name']->renderRow() ?>