本文整理汇总了PHP中sfPropelPager::setCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP sfPropelPager::setCriteria方法的具体用法?PHP sfPropelPager::setCriteria怎么用?PHP sfPropelPager::setCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfPropelPager
的用法示例。
在下文中一共展示了sfPropelPager::setCriteria方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeList
public function executeList(Criteria $crit = null)
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
if ($crit == null) {
$crit = new Criteria();
}
$this->sort($crit);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($crit, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), ' payment_journal_s'));
$this->getUser()->setAttribute('max_per_page', $rpp, ' payment_journal_s');
$pager = new sfPropelPager('PaymentJournal', $rpp);
$pager->setCriteria($crit);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, ' payment_journal_s'));
$this->getUser()->setAttribute('page', $page, ' payment_journal_s');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
if ($acl->getAddPriv()) {
array_unshift($actions, array('name' => 'add', 'url' => ' payment_journal_s/create', 'color' => 'green'));
}
array_unshift($actions, array('name' => '_AS_CSV_', 'url' => ' payment_journal_s/listAsCSV', 'color' => 'white', 'type' => 'direct'));
array_unshift($actions, array('name' => '_AS_PDF_', 'url' => ' payment_journal_s/listAsPDF', 'color' => 'white', 'type' => 'direct'));
$this->actions = $actions;
$this->subtitle = '';
$this->byStudent = true;
}
示例2: executeIndex
/**
* Executes index action
*
* @param sfWebRequest $request
*/
public function executeIndex(sfWebRequest $request)
{
$this->filter = new PropertyFormFilter();
//$this->property_list = PropertyPeer::doSelect(new Criteria());
$this->sort = $this->getRequestParameter('sort');
$this->sort_type = $this->getRequestParameter('sort_type');
$criteria = new Criteria();
if (!is_null($this->sort)) {
if (!is_null($this->sort_type) && $this->sort_type == 'desc') {
$criteria->addDescendingOrderByColumn(PropertyPeer::$this->sort);
} elseif (!is_null($this->sort_type) && $this->sort_type == 'asc') {
$criteria->addAscendingOrderByColumn(PropertyPeer::$this->sort);
}
}
if ($request->hasParameter('property_filters')) {
$property_filters = $request->getParameter('property_filters');
$this->filter->bind($property_filters);
if ($this->filter->isValid()) {
!empty($property_filters['municipality']['text']) ? $criteria->add(PropertyPeer::MUNICIPALITY, "%" . $property_filters['municipality']['text'] . "%", Criteria::LIKE) : null;
!empty($property_filters['offer_id']) ? $criteria->add(PropertyPeer::OFFER_ID, $property_filters['offer_id']) : null;
!empty($property_filters['type_id']) ? $criteria->add(PropertyPeer::TYPE_ID, $property_filters['type_id']) : null;
!empty($property_filters['typology_id']) ? $criteria->add(PropertyPeer::TYPOLOGY_ID, $property_filters['typology_id']) : null;
!empty($property_filters['state_id']) ? $criteria->add(PropertyPeer::STATE_ID, $property_filters['state_id']) : null;
!empty($property_filters['price']['text']) ? $criteria->add(PropertyPeer::PRICE, $property_filters['price']['text'], Criteria::LESS_EQUAL) : null;
}
}
$pager = new sfPropelPager('Property', sfConfig::get('app_max_propertyes_list', 20));
$pager->setPeerMethod('doSelectJoinAll');
$pager->setCriteria($criteria);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
}
示例3: getPager
public static function getPager($max = 10, $page = 1, $date_req = null, $pass_name = null, $req_name = null, $pass_lname = null, $req_lname = null)
{
$c = new Criteria();
$c->addJoin(self::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::REQUESTER_ID, RequesterPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::alias('c1', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addJoin(RequesterPeer::PERSON_ID, PersonPeer::alias('c2', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addAlias('c1', PersonPeer::TABLE_NAME);
$c->addAlias('c2', PersonPeer::TABLE_NAME);
if ($date_req) {
$c->add(self::DATE_REQUESTED, '%' . date('Y-m-d', strtotime($date_req)) . '%', Criteria::LIKE);
}
if ($pass_name) {
$c->add(PersonPeer::alias("c1", PersonPeer::FIRST_NAME), $pass_name . '%', Criteria::LIKE);
}
if ($req_name) {
$c->add(PersonPeer::alias("c2", PersonPeer::FIRST_NAME), $req_name . '%', Criteria::LIKE);
}
if ($pass_lname) {
$c->add(PersonPeer::alias("c1", PersonPeer::LAST_NAME), $pass_lname . '%', Criteria::LIKE);
}
if ($req_lname) {
$c->add(PersonPeer::alias("c2", PersonPeer::LAST_NAME), $req_lname . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(self::DATE_REQUESTED);
$pager = new sfPropelPager('Itinerary', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例4: getPager
public static function getPager($max = 10, $page = 1, $fbo_name = null, $discount = null, $default = null, $ident = null, $name = null, $city = null, $state = null)
{
$c = new Criteria();
$c->addJoin(self::AIRPORT_ID, AirportPeer::ID);
if ($fbo_name) {
$c->add(self::NAME, '%' . $fbo_name . '%', Criteria::LIKE);
}
if ($discount) {
$c->add(self::FUEL_DISCOUNT, '%' . $discount . '%', Criteria::LIKE);
}
if ($default) {
$c->add(self::FUEL_DISCOUNT, '%' . $discount . '%', Criteria::LIKE);
}
if ($ident) {
$c->add(AirportPeer::IDENT, $ident . '%', Criteria::LIKE);
}
if ($name) {
$c->add(AirportPeer::NAME, $name . '%', Criteria::LIKE);
}
if ($city) {
$c->add(AirportPeer::CITY, $city . '%', Criteria::LIKE);
}
if ($state) {
$c->add(AirportPeer::STATE, $state . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(self::NAME);
$pager = new sfPropelPager('Fbo', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例5: doSearch
static function doSearch($TEXT, $idS = 1, $page = 1)
{
$C = new Criteria();
$C = AgendatelefonicaPeer::getCriteriaActiu($C, $idS);
$PARAULES = explode(" ", $TEXT);
$PAR2 = array();
foreach ($PARAULES as $P) {
if (strlen($P) > 2) {
$PAR2[] = trim($P);
}
}
foreach ($PAR2 as $P) {
$text1Criterion = $C->getNewCriterion(AgendatelefonicaPeer::NOM, '%' . $P . '%', CRITERIA::LIKE);
$text2Criterion = $C->getNewCriterion(AgendatelefonicaPeer::TAGS, '%' . $P . '%', CRITERIA::LIKE);
$text3Criterion = $C->getNewCriterion(AgendatelefonicaPeer::ENTITAT, '%' . $P . '%', CRITERIA::LIKE);
$text1Criterion->addOr($text2Criterion);
$text1Criterion->addOr($text3Criterion);
$C->add($text1Criterion);
}
$C->add(AgendatelefonicaPeer::SITE_ID, $idS);
$C->addGroupByColumn(AgendatelefonicaPeer::AGENDATELEFONICAID);
$C->addAscendingOrderByColumn(AgendatelefonicaPeer::NOM);
$pager = new sfPropelPager('Agendatelefonica', 20);
$pager->setCriteria($C);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例6: executeList
/**
* Displays either the inbox or outbox
*/
public function executeList()
{
if ($this->getRequestParameter('folder') == 'outbox') {
//Grab all sent messages
$c = PrivateMessagePeer::getCriteriaForSentToUser($this->getUser()->getRaykuUserId());
//Name of the partial to use for each message
$this->messageRowPartialName = 'message_row_outbox';
//Name the URL for the pager
$url = '@outbox';
} else {
//Grab all recieved messages
$c = PrivateMessagePeer::getCriteriaForRecievedByUser($this->getUser()->getRaykuUserId());
//Name of the partial to use for each message
$this->messageRowPartialName = 'message_row_inbox';
//Name the URL for the pager
$url = '@inbox';
}
//Setup the pager
$pager = new sfPropelPager('PrivateMessage', sfConfig::get('app_messages_messages_per_page', 10));
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->raykuPager = new RaykuPagerRenderer($pager);
$this->raykuPager->setBaseUrl($url);
}
示例7: getPager
public static function getPager($max = 10, $page = 1, $firstname = null, $lastname = null, $city = null, $state = null, $agency_name = null)
{
$c = new Criteria();
$c->addJoin(PersonPeer::ID, self::PERSON_ID);
$c->addJoin(self::AGENCY_ID, AgencyPeer::ID);
if ($firstname) {
$c->add(PersonPeer::FIRST_NAME, $firstname . '%', Criteria::LIKE);
}
if ($lastname) {
$c->add(PersonPeer::LAST_NAME, $lastname . '%', Criteria::LIKE);
}
if ($city) {
$c->add(PersonPeer::CITY, $city . '%', Criteria::LIKE);
}
if ($state) {
$c->add(PersonPeer::STATE, $state . '%', Criteria::LIKE);
}
if ($agency_name) {
$c->add(AgencyPeer::NAME, $agency_name . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(PersonPeer::FIRST_NAME);
$pager = new sfPropelPager('Requester', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例8: doSearch
static function doSearch($TEXT, $PAGE, $ACCIO, $idS)
{
$C = new Criteria();
$C = self::getCriteriaActiu($C, $idS);
$PARAULES = explode(" ", $TEXT);
$PAR2 = array();
foreach ($PARAULES as $P) {
if (strlen($P) > 2) {
$PAR2[] = trim($P);
}
}
foreach ($PAR2 as $P) {
$text1Criterion = $C->getNewCriterion(MissatgesPeer::TITOL, '%' . $P . '%', CRITERIA::LIKE);
$text2Criterion = $C->getNewCriterion(MissatgesPeer::TEXT, '%' . $P . '%', CRITERIA::LIKE);
$text1Criterion->addOr($text2Criterion);
$C->add($text1Criterion);
}
$C->addGroupByColumn(MissatgesPeer::MISSATGEID);
$C->addDescendingOrderByColumn(self::PUBLICACIO);
$C->addDescendingOrderByColumn(self::MISSATGEID);
if ($ACCIO != 'SF') {
$C->add(MissatgesPeer::PUBLICACIO, date('Y-m-d', time()), CRITERIA::LESS_EQUAL);
} else {
$C->add(MissatgesPeer::PUBLICACIO, date('Y-m-d', time()), CRITERIA::GREATER_THAN);
}
$pager = new sfPropelPager('Missatges', 20);
$pager->setCriteria($C);
$pager->setPage($PAGE);
$pager->init();
return $pager;
}
示例9: getPager
public static function getPager($max = 10, $page = 1, $camp_name = null, $agency_name = null, $agency_city = null, $agency_state = null, $agency_country = null, $airport_ident = null, $airport_city = null, $airport_state = null)
{
$c = new Criteria();
$c->addJoin(self::AGENCY_ID, AgencyPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::AIRPORT_ID, AirportPeer::ID, Criteria::LEFT_JOIN);
if ($camp_name) {
$c->add(self::CAMP_NAME, $camp_name . '%', Criteria::LIKE);
}
if ($agency_name) {
$c->add(AgencyPeer::NAME, $agency_name . '%', Criteria::LIKE);
}
if ($agency_city) {
$c->add(AgencyPeer::CITY, $agency_city . '%', Criteria::LIKE);
}
if ($agency_state) {
$c->add(AgencyPeer::STATE, $agency_state . '%', Criteria::LIKE);
}
if ($airport_ident) {
$c->add(AirportPeer::IDENT, $airport_ident . '%', Criteria::LIKE);
}
if ($airport_city) {
$c->add(AirportPeer::CITY, $airport_city . '%', Criteria::LIKE);
}
if ($airport_state) {
$c->add(AirportPeer::STATE, $airport_state . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(self::CAMP_NAME);
$pager = new sfPropelPager('Camp', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例10: getPager
/**
* Searches passengers by some criteria
* @param int $max Maximum people per page
* @param int $page
* @return sfPropelPager
*/
public static function getPager($max = 10, $page = 1, $firstname = null, $lastname = null, $city = null, $state = null, $country = null, $county = null, $exclude_ids = array())
{
$c = new Criteria();
$c->addJoin(self::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
if ($firstname) {
$c->add(PersonPeer::FIRST_NAME, $firstname . '%', Criteria::LIKE);
}
if ($lastname) {
$c->add(PersonPeer::LAST_NAME, $lastname . '%', Criteria::LIKE);
}
if ($city) {
$c->add(PersonPeer::CITY, $city . '%', Criteria::LIKE);
}
if ($state) {
$c->add(PersonPeer::STATE, $state . '%', Criteria::LIKE);
}
if ($country) {
$c->add(PersonPeer::COUNTRY, $country . '%', Criteria::LIKE);
}
if ($county) {
$c->add(PersonPeer::COUNTY, $county . '%', Criteria::LIKE);
}
if (!empty($exclude_ids)) {
$c->add(self::ID, $exclude_ids, Criteria::NOT_IN);
}
$c->addAscendingOrderByColumn(PersonPeer::FIRST_NAME);
$pager = new sfPropelPager('Passenger', $max);
$pager->setPeerMethod('doSelectJoinPerson');
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例11: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$ct = new Criteria();
$ct->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($ct);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$c->add(GradeSpecPeer::TYPE_SPEC, GradeSpec::OTHERS, Criteria::NOT_EQUAL);
$c->add(GradeSpecPeer::PARENT, 0, Criteria::IN);
$this->sort($c);
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'grade_spec'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'grade_spec');
$pager = new sfPropelPager('GradeSpec', $rpp);
#$pager->setPeerMethod('doSelectOrdered');
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'grade_spec'));
$this->getUser()->setAttribute('page', $page, 'grade_spec');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array();
if ($acl->getAddPriv()) {
array_unshift($actions, array('name' => 'add', 'url' => 'grade_spec_new/create', 'color' => 'black'));
}
$this->actions = $actions;
$this->subtitle = '';
}
示例12: getPager
public static function getPager($max = 10, $page = 1, $ident = null, $name = null, $city = null, $state = null, $wing_name = null, $closed = null)
{
$c = new Criteria();
$c->addJoin(self::WING_ID, WingPeer::ID, Criteria::LEFT_JOIN);
if ($ident) {
$c->add(self::IDENT, $ident . '%', Criteria::LIKE);
}
if ($name) {
$c->add(self::NAME, $name . '%', Criteria::LIKE);
}
if ($city) {
$c->add(self::CITY, $city . '%', Criteria::LIKE);
}
if ($state) {
$c->add(self::STATE, $state . '%', Criteria::LIKE);
}
if ($wing_name) {
$c->add(WingPeer::NAME, $wing_name . '%', Criteria::LIKE);
}
if ($closed) {
$c->add(self::CLOSED, $closed . '%', Criteria::LIKE);
}
self::addSelectColumns($c);
$c->addAsColumn("fbos", "(Select COUNT(a.id) from fbo as f, airport as a where f.airport_id = a.id and a.id = " . self::ID . " group by a.id)");
$c->addAscendingOrderByColumn(self::IDENT);
$pager = new sfPropelPager('Airport', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例13: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
$c->addJoin(StudentPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
// filter out graduated alumni
$cton1 = $c->getNewCriterion(StudentPeer::STATUS, Student::STATUS_GRADUATE, Criteria::EQUAL);
$cton2 = $c->getNewCriterion(StudentPeer::STATUS, Student::STATUS_OVERDUE, Criteria::EQUAL);
$cton1->addOr($cton2);
$c->add($cton1);
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'alumni'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'alumni');
$pager = new sfPropelPager('Student', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'alumni'));
$this->getUser()->setAttribute('page', $page, 'student');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
#if ($acl->getAddPriv()) array_unshift($actions, array('name'=>'add','url'=>'student/create', 'color'=>'green'));
$this->actions = $actions;
}
示例14: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'academic_cost_component'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'academic_cost_component');
$pager = new sfPropelPager('AcademicCostComponent', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'academic_cost_component'));
$this->getUser()->setAttribute('page', $page, 'academic_cost_component');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
if ($acl->getAddPriv()) {
array_unshift($actions, array('name' => 'add', 'url' => 'academic_cost_component/create', 'color' => 'black'));
}
$this->actions = $actions;
$cw = new Criteria();
$cw->add(JobPeer::PARENT, $job->getId());
$modules = JobPeer::doSelect($cw);
$this->modules = $modules;
$actions2 = array(array('name' => '<span>Komponen Biaya Sekolah</span>', 'url' => $job->getCode(), 'color' => 'sun', 'type' => 'direct'));
$this->actions2 = $actions2;
}
示例15: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
$this->forward404Unless($student);
$this->student = $student;
$c = new Criteria();
$c->add(StudentLeavePeer::STUDENT_ID, $student->getId());
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student_leave_by_student'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'student_leave_by_student');
$pager = new sfPropelPager('StudentLeave', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student_leave_by_student'));
$this->getUser()->setAttribute('page', $page, 'student_leave_by_student');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
if ($acl->getAddPriv()) {
array_unshift($actions, array('name' => 'add', 'url' => 'student_leave_by_student/create?student_id=' . $student->getId(), 'color' => 'green'));
}
array_unshift($actions, array('type' => 'direct', 'name' => 'paymentSlip', 'url' => 'student_leave_by_student/paymentSlip?student_id=' . $student->getId(), 'color' => 'white'));
$this->actions = $actions;
$this->subtitle = $student->toString();
}