Skip to content

Commit

Permalink
adicionado modulo agenda
Browse files Browse the repository at this point in the history
  • Loading branch information
henriqueboaventura committed Jun 23, 2010
1 parent 07a6131 commit 3c554c7
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/backend/modules/agenda/actions/actions.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

require_once dirname(__FILE__).'/../lib/agendaGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/agendaGeneratorHelper.class.php';

/**
* agenda actions.
*
* @package swbrasil
* @subpackage agenda
* @author Your name here
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class agendaActions extends autoAgendaActions
{
}
37 changes: 37 additions & 0 deletions apps/backend/modules/agenda/config/generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
generator:
class: sfDoctrineGenerator
param:
model_class: Agenda
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: agenda
with_doctrine_route: true
actions_base_class: sfActions

config:
actions: ~
fields:
title:
label: Evento
date:
label: Data
date_format: dd/MM/yy
time:
label: Hora
place:
label: Local
info:
label: Informações
list:
display: [title, date]
title: Eventos Agendados
filter:
class: false
form: ~
edit:
title: Alterar Evento "%%title%%"
new:
title: Criar Evento
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* agenda module configuration.
*
* @package swbrasil
* @subpackage agenda
* @author Your name here
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class agendaGeneratorConfiguration extends BaseAgendaGeneratorConfiguration
{
}
13 changes: 13 additions & 0 deletions apps/backend/modules/agenda/lib/agendaGeneratorHelper.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* agenda module helper.
*
* @package swbrasil
* @subpackage agenda
* @author Your name here
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class agendaGeneratorHelper extends BaseAgendaGeneratorHelper
{
}
22 changes: 22 additions & 0 deletions apps/frontend/modules/agenda/actions/actions.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* agenda actions.
*
* @package swbrasil
* @subpackage agenda
* @author Your name here
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class agendaActions extends sfActions
{
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeList(sfWebRequest $request)
{
$this->events = Doctrine::getTable('Agenda')->findEventsOrderedByDate();
}
}
Empty file.
16 changes: 16 additions & 0 deletions apps/frontend/modules/agenda/templates/listSuccess.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
use_helper('Date');
?>
<h2>Agenda</h2>
<dl>
<?php
foreach($events as $event){
?>
<dt><?php echo format_date($event->date,'dd/MM/y'); ?> - <?php echo $event->title; ?></dt>
<dd>Hora: <?php echo format_date($event->time,'hh:mm') ?></dd>
<dd>Local: <?php echo $event->place ?></dd>
<dd class="info">Informações: <?php echo $event->info ?></dd>
<?php
}
?>
</dl>
7 changes: 7 additions & 0 deletions data/fixtures/080_agenda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Agenda:
Agenda1:
title: I Encontro do Núcleo PR da Associação Brasileira da SW
date: 2010-07-10
time: 14:00:00
place: AFECE - Associação Franciscana de Educação ao Cidadão Especial
info: 14h - Palestra com Jô Nunes - presidente da ABSW (Associação Brasileira da Síndrome de Williams) 14h30h - Palestra com Dr. Salmo Raskin (médico geneticista), Dr. Rui Pilotto (médico geneticista e coordenador estadual de prevenção e saúde da APAE/PR) e Dra. Rachel Honjo (médica pesquisadora, USP EmbrioConsult - Inst. da Criança HCSP). 16h - Depoimentos de familiares 17h - Café e confraternização
16 changes: 16 additions & 0 deletions lib/filter/doctrine/AgendaFormFilter.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* Agenda filter form.
*
* @package swbrasil
* @subpackage filter
* @author Your name here
* @version SVN: $Id: sfDoctrineFormFilterTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class AgendaFormFilter extends BaseAgendaFormFilter
{
public function configure()
{
}
}
56 changes: 56 additions & 0 deletions lib/filter/doctrine/base/BaseAgendaFormFilter.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* Agenda filter form base class.
*
* @package swbrasil
* @subpackage filter
* @author Your name here
* @version SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
*/
abstract class BaseAgendaFormFilter extends BaseFormFilterDoctrine
{
public function setup()
{
$this->setWidgets(array(
'title' => new sfWidgetFormFilterInput(array('with_empty' => false)),
'date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
'time' => new sfWidgetFormFilterInput(array('with_empty' => false)),
'place' => new sfWidgetFormFilterInput(array('with_empty' => false)),
'info' => new sfWidgetFormFilterInput(array('with_empty' => false)),
));

$this->setValidators(array(
'title' => new sfValidatorPass(array('required' => false)),
'date' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
'time' => new sfValidatorPass(array('required' => false)),
'place' => new sfValidatorPass(array('required' => false)),
'info' => new sfValidatorPass(array('required' => false)),
));

$this->widgetSchema->setNameFormat('agenda_filters[%s]');

$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

$this->setupInheritance();

parent::setup();
}

public function getModelName()
{
return 'Agenda';
}

public function getFields()
{
return array(
'id' => 'Number',
'title' => 'Text',
'date' => 'Date',
'time' => 'Text',
'place' => 'Text',
'info' => 'Text',
);
}
}
22 changes: 22 additions & 0 deletions lib/form/doctrine/AgendaForm.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Agenda form.
*
* @package swbrasil
* @subpackage form
* @author Your name here
* @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class AgendaForm extends BaseAgendaForm
{
public function configure()
{
$this->widgetSchema['info'] = new sfWidgetFormTextarea();
$this->widgetSchema['date'] = new sfWidgetFormDate(array('format' => '%day%/%month%/%year%'));

$this->widgetSchema['info'] = new isicsWidgetFormTinyMCE(array(
'tiny_options' => sfConfig::get('app_tiny_mce_my_settings', array()))
);
}
}
49 changes: 49 additions & 0 deletions lib/form/doctrine/base/BaseAgendaForm.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* Agenda form base class.
*
* @method Agenda getObject() Returns the current form's model object
*
* @package swbrasil
* @subpackage form
* @author Your name here
* @version SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
*/
abstract class BaseAgendaForm extends BaseFormDoctrine
{
public function setup()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'title' => new sfWidgetFormInputText(),
'date' => new sfWidgetFormDate(),
'time' => new sfWidgetFormTime(),
'place' => new sfWidgetFormInputText(),
'info' => new sfWidgetFormInputText(),
));

$this->setValidators(array(
'id' => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
'title' => new sfValidatorString(array('max_length' => 100)),
'date' => new sfValidatorDate(),
'time' => new sfValidatorTime(),
'place' => new sfValidatorString(array('max_length' => 100)),
'info' => new sfValidatorPass(),
));

$this->widgetSchema->setNameFormat('agenda[%s]');

$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

$this->setupInheritance();

parent::setup();
}

public function getModelName()
{
return 'Agenda';
}

}
15 changes: 15 additions & 0 deletions lib/model/doctrine/Agenda.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* Agenda
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* @package swbrasil
* @subpackage model
* @author Your name here
* @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
*/
class Agenda extends BaseAgenda
{
}
21 changes: 21 additions & 0 deletions lib/model/doctrine/AgendaTable.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php


class AgendaTable extends Doctrine_Table
{

public static function getInstance()
{
return Doctrine_Core::getTable('Agenda');
}

public function findEventsOrderedByDate()
{
$q = $this->createQuery()
->from('Agenda a')
->orderBy('a.date ASC')
->orderBy('a.time ASC');

return $q->execute();
}
}
68 changes: 68 additions & 0 deletions lib/model/doctrine/base/BaseAgenda.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

/**
* BaseAgenda
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* @property string $title
* @property date $date
* @property time $time
* @property string $place
* @property text $info
*
* @method string getTitle() Returns the current record's "title" value
* @method date getDate() Returns the current record's "date" value
* @method time getTime() Returns the current record's "time" value
* @method string getPlace() Returns the current record's "place" value
* @method text getInfo() Returns the current record's "info" value
* @method Agenda setTitle() Sets the current record's "title" value
* @method Agenda setDate() Sets the current record's "date" value
* @method Agenda setTime() Sets the current record's "time" value
* @method Agenda setPlace() Sets the current record's "place" value
* @method Agenda setInfo() Sets the current record's "info" value
*
* @package swbrasil
* @subpackage model
* @author Your name here
* @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
*/
abstract class BaseAgenda extends sfDoctrineRecord
{
public function setTableDefinition()
{
$this->setTableName('agenda');
$this->hasColumn('title', 'string', 100, array(
'type' => 'string',
'notnull' => true,
'length' => '100',
));
$this->hasColumn('date', 'date', null, array(
'type' => 'date',
'notnull' => true,
));
$this->hasColumn('time', 'time', null, array(
'type' => 'time',
'notnull' => true,
));
$this->hasColumn('place', 'string', 100, array(
'type' => 'string',
'notnull' => true,
'length' => '100',
));
$this->hasColumn('info', 'text', null, array(
'type' => 'text',
'notnull' => true,
));

$this->option('type', 'MyISAM');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
}

public function setUp()
{
parent::setUp();

}
}
Loading

0 comments on commit 3c554c7

Please sign in to comment.