openPNEの常用方法を共有します。

4594 ワード

 
<?php include_partial('sidemenu',array('form'=>'asdfgasgsad'));?> '_sidemenu.php' ,'_sidemenu.php' $form
<?php
op_include_box('vote_question_create_box','<strong>asdfasdf</strong>',array('title'=>' ','moreInfo'=>array(' ',link_to(' 2','@my_index'))));
?>
<?php
op_include_box('vote_question_create_box',get_slot('pager'),array('title'=>' ','moreInfo'=>array(' ',link_to(' 2','@my_index'))));
?>
'vote_question_create_box' ,'<strong>asdfasdf</strong>' get_slot('pager') ( slot get_slot() include_slot(),
slot include_slot())
title , 'vote_question_create_box' , 'moreInfo'

<?php slot('pager'); ?> slot
<?php echo 'asdfasgsadfasdfaaaaaaaaaaaaaaaaaaaaaa' ?>
<?php end_slot() ?>
<?php include_slot('pager'); ?> slot , slot

<?php
op_include_form('vote_question_from',$form,array('title'=>' ','url'=>url_for('@vote_update?id='.$form->getObject()->getId()),));
?> ,'vote_question_from' ,$form , title url ,

<?php
public function executeEdit(sfWebRequest $request){
$object = $this->getRoute()->getObject();
// 404
$this->forward404Unless($this->getUser()->getMemberId() == $object->getMemberId());//$object->getMemberId() id member_id
$this->form = new VoteQuestionForm($object);
// http://localhost/openpne/web/vote/edit/1
}
?>

<?php op_include_pager_navigation($pager, '@tasks_list?page=%d'); ?>
$pager $this->pager = Doctrine::getTable('VoteQuestion')->getListPager($request->getParameter('page'));
PluginVoteQuestionTable getListPager() ↓
<?php
class PluginVoteQuestionTable extends Doctrine_Table
{
public function getListPager($page = 1,$size = 20)
{
$query = $this->createQuery()->orderBy('updated_at DESC');
$pager = new sfDoctrinePager('VoteQuestion',$size);// ,
$pager->setQuery($query);//
$pager->setPage($page);//
$pager->init();
return $pager;
}
}
?>

<?php foreach($pager->getResults() as $item): // openPNE ?>
<dl>
<dt><?php echo op_format_date($item->getUpdatedAt(),'f') //'f' ?></dt><!--op_format_date() 2011-11-10 ‘-' -->
<dd><?php echo link_to(sprintf("%s(%d)",$item->getTitle(),count($item->getVoteAnswers())),'@vote_show?id='.$item->getId()) ?></dd><!--$item->getTitle() title -->
</dl>
<?php endforeach; ?>

<?php echo link_to('sdsfg','@vote_show?id='.$item->getId()) ?> <a href='vote/show?id=...'>sdsfg</a>



action=" web/ ==== / ==== web "


$this->tasksObject = $this->getRoute()->getObject();
$this->getRoute()->getObject();// id get+ () , $tasksObject-getId();
, vote_question

<?php
class opVotePluginFrontendRouteCollection extends sfRouteCollection
{
public function __construct(array $options)
{
parent::__construct($options);
$this->routes = array(
'vote_edit' => new sfDoctrineRoute(
'/vote/edit/:id',
array('module' => 'vote', 'action' => 'edit'),
array('id' => '\d+', 'sf_method' => array('get')),
array('model' => 'VoteQuestion', 'type' => 'object')
),
);
}
}
?>