当前位置: 首页>>代码示例>>PHP>>正文


PHP Criteria类代码示例

本文整理汇总了PHP中Criteria的典型用法代码示例。如果您正苦于以下问题:PHP Criteria类的具体用法?PHP Criteria怎么用?PHP Criteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Criteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeUpdate

 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
     $this->forward404Unless($course = CoursePeer::retrieveByPk($request->getParameter('id')), sprintf('Object course does not exist (%s).', $request->getParameter('id')));
     $values = array('edit' => 'true');
     $this->form = new CourseForm($course, $values);
     $c = new Criteria();
     $c->add(CourseDetailPeer::COURSE_ID, $request->getParameter('id'));
     $courseDetail = CourseDetailPeer::doSelectOne($c);
     if ($courseDetail !== null) {
         $this->form2 = new CourseDetailForm($courseDetail);
     } else {
         $this->form2 = new CourseDetailForm(new CourseDetail());
     }
     $c2 = new Criteria();
     $c2->add(CourseDetailPeer::COURSE_ID, $request->getParameter('id'));
     $courseDisAssoc = CourseDisciplineAssociationPeer::doSelectOne($c2);
     if ($courseDisAssoc !== null) {
         $this->form3 = new CourseDisciplineAssociationForm($courseDisAssoc);
     } else {
         $this->form3 = new CourseDisciplineAssociationForm(new CourseDisciplineAssociation());
     }
     $this->submitForm($request, $this->form, $this->form2, $this->form3);
     //at this point the save has failed
     $c = new Criteria();
     //$c->addSelectColumn(CoursePeer::ID);
     $this->course_list = $this->getCourselist($c);
     $this->setTemplate('index');
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:29,代码来源:actions.class.php

示例2: executeList

 public function executeList()
 {
     $c = new Criteria();
     $c->add(DosagePeer::STATUS, Constant::RECORD_STATUS_DELETED, Criteria::NOT_EQUAL);
     $c->addAscendingOrderByColumn(DosagePeer::TITLE);
     $this->dosages = DosagePeer::doSelect($c);
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:7,代码来源:actions.class.php

示例3: execute

 public function execute(&$value, &$error)
 {
     $id = $this->getContext()->getRequest()->getParameter('id');
     $name = $value;
     $c = new Criteria();
     $c->add(UserPeer::USERNAME, $name);
     $user = UserPeer::doSelectOne($c);
     $condition = true;
     if ($user) {
         if ($id && $id == $user->getId()) {
             $condition = true;
         } else {
             $error = 'User ' . $user->getUsername() . ' already Exist.';
             $condition = false;
         }
     }
     $roles = RolePeer::doSelect(new Criteria());
     $found = false;
     foreach ($roles as $role) {
         if ($this->getContext()->getRequest()->getParameter($role->getName(), 0) == 1) {
             $found = true;
         }
     }
     if (!$found) {
         $error = 'Please select atleast one role';
         $condition = false;
     }
     return $condition;
 }
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:29,代码来源:uniqueuserValidator.class.php

示例4: build

 public function build($runData)
 {
     $site = $runData->getTemp("site");
     $runData->contextAdd("site", $site);
     // select templates
     $templatesCategory = DB_CategoryPeer::instance()->selectByName("template", $site->getSiteId());
     if ($templatesCategory == null) {
         $runData->contextAdd("noTemplates", true);
         return;
     }
     $c = new Criteria();
     $c->add("category_id", $templatesCategory->getCategoryId());
     $c->addOrderAscending("title");
     $templates = DB_PagePeer::instance()->select($c);
     $runData->contextAdd("templates", $templates);
     // get all categories for the site
     $c = new Criteria();
     $c->add("site_id", $site->getSiteId());
     $c->addOrderAscending("replace(name, '_', '00000000')");
     $categories = DB_CategoryPeer::instance()->select($c);
     $runData->contextAdd("categories", $categories);
     // also prepare categories to put into javascript...
     $cats2 = array();
     foreach ($categories as $category) {
         $cats2[] = $category->getFieldValuesArray();
     }
     $runData->ajaxResponseAdd("categories", $cats2);
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:28,代码来源:ManageSiteTemplatesModule.php

示例5: configure

 public function configure()
 {
     // Sort
     $activitySortCriteria = new Criteria();
     $activitySortCriteria->addAscendingOrderByColumn(ActivityPeer::NAME);
     $userSortCriteria = new Criteria();
     $userSortCriteria->addAscendingOrderByColumn(UserPeer::FAMILY_NAME);
     // Remove some fields
     //unset($this['usergroup_has_chief_list']);
     // Labels
     $activityItem = ConfigurationHelper::getParameter('Rename', 'activity_label');
     if (is_null($activityItem) || empty($activityItem)) {
         $activityItem = 'Activities';
     }
     $this->widgetSchema->setLabel('usergroup_has_chief_list', 'Leader(s)');
     $this->widgetSchema->setLabel('usergroup_has_user_list', 'Member(s)');
     $this->widgetSchema->setLabel('usergroup_has_activity_list', $activityItem);
     // Validators
     $this->validatorSchema['name'] = new sfXSSValidatorString(array('max_length' => 64));
     // Options
     $this->widgetSchema['usergroup_has_chief_list']->setOption('expanded', true);
     $this->widgetSchema['usergroup_has_chief_list']->setOption('criteria', $userSortCriteria);
     $this->validatorSchema['usergroup_has_chief_list']->setOption('required', true);
     $this->widgetSchema['usergroup_has_user_list']->setOption('expanded', true);
     $this->widgetSchema['usergroup_has_user_list']->setOption('criteria', $userSortCriteria);
     $this->widgetSchema['usergroup_has_activity_list']->setOption('expanded', true);
     $this->widgetSchema['usergroup_has_activity_list']->setOption('criteria', $activitySortCriteria);
     $this->validatorSchema['usergroup_has_activity_list']->setOption('required', true);
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:29,代码来源:UsergroupForm.class.php

示例6: saveAuthorArticleList

 public function saveAuthorArticleList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['author_article_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(AuthorArticlePeer::AUTHOR_ID, $this->object->getPrimaryKey());
     AuthorArticlePeer::doDelete($c, $con);
     $values = $this->getValue('author_article_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new AuthorArticle();
             $obj->setAuthorId($this->object->getPrimaryKey());
             $obj->setArticleId($value);
             $obj->save();
         }
     }
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:25,代码来源:BaseAuthorForm.class.php

示例7: executeRun

 public function executeRun()
 {
     $this->error = false;
     if (!$this->applicant) {
         $this->error = true;
         $this->messageError = 'Applicant Not Found';
         return false;
     }
     $ta = $this->applicant;
     $this->ta_detail = $ta->getTestApplicantDetail();
     if (!$this->ta_detail) {
         $this->error = true;
         $this->messageError = 'Applicant Detail Not Found';
         return false;
     }
     $cw = new Criteria();
     $cw->add(DepartmentDetailPeer::DEPARTMENT_ID, $ta->getDepartment1());
     $this->department_detail = DepartmentDetailPeer::doSelectOne($cw);
     if (!$this->department_detail) {
         $this->error = true;
         $this->messageError = 'Department not found';
         return false;
     }
     $c = new Criteria();
     $c->add(PaymentJournalPeer::PAYER, $ta->getId());
     $c->add(PaymentJournalPeer::PAYER_TYPE, PaymentJournal::PAYER_TYPE_APPLICANT);
     $payments = PaymentJournalPeer::doSelect($c);
     if (!$payments) {
         $this->error = true;
         $this->messageError = 'Payments not fond';
         return false;
     }
     $this->payments = $payments;
 }
开发者ID:taryono,项目名称:school,代码行数:34,代码来源:components.class.php

示例8: getAsistencia

 public static function getAsistencia($evaluacion, $aspirante)
 {
     $criteria = new Criteria();
     $criteria->add(AsistenciasPeer::EVALUACIONES_ID, $evaluacion, Criteria::EQUAL);
     $criteria->add(AsistenciasPeer::ASPIRANTES_ID, $aspirante, Criteria::EQUAL);
     return self::doSelectOne($criteria);
 }
开发者ID:qwerfaqs,项目名称:psicotest,代码行数:7,代码来源:AsistenciasPeer.php

示例9: saveUsuarioRolList

 public function saveUsuarioRolList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['usuario_rol_list'])) {
         // somebody has unset this widget
         return;
     }
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(UsuarioRolPeer::FK_ROL_ID, $this->object->getPrimaryKey());
     UsuarioRolPeer::doDelete($c, $con);
     $values = $this->getValue('usuario_rol_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new UsuarioRol();
             $obj->setFkRolId($this->object->getPrimaryKey());
             $obj->setFkUsuarioId($value);
             $obj->save();
         }
     }
 }
开发者ID:mediasadc,项目名称:alba,代码行数:25,代码来源:BaseRolForm.class.php

示例10: getAllCommentsForResource

 public static function getAllCommentsForResource($resource, $con = null)
 {
     $c = new Criteria();
     $c->add(sfEmendCommentPeer::URL, $resource);
     $c->add(sfEmendCommentPeer::IS_PUBLIC, 1);
     return sfEmendCommentPeer::doSelect($c, $con);
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:7,代码来源:sfEmendCommentPeer.php

示例11: saveProductHasColorList

 public function saveProductHasColorList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['product_has_color_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(ProductHasColorPeer::COLOR_ID, $this->object->getPrimaryKey());
     ProductHasColorPeer::doDelete($c, $con);
     $values = $this->getValue('product_has_color_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new ProductHasColor();
             $obj->setColorId($this->object->getPrimaryKey());
             $obj->setProductId($value);
             $obj->save();
         }
     }
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:25,代码来源:BaseColorForm.class.php

示例12: doSaveMedia

 public function doSaveMedia($v)
 {
     if ($v == null) {
         $image = $this->getImagePath();
         if ($this->isNew) {
             $content = file_get_contents(sfConfig::get('sf_root_dir') . '/public_html' . $image);
             $size = getimagesize(sfConfig::get('sf_root_dir') . '/public_html' . $image);
         } else {
             return $this->getObject()->getImagesId();
         }
     } else {
         $content = file_get_contents($v->getTempName());
         $size = getimagesize($v->getTempName());
     }
     $hash = md5($content);
     $criteria = new Criteria();
     $criteria->add(ImagesPeer::CONTENT_HASH, $hash);
     $obj = ImagesPeer::doSelectOne($criteria);
     try {
         if (empty($obj)) {
             $obj = new Images();
             $obj->setNameDownloadedFile($v->getOriginalName())->setNameFileForPage($v->getOriginalName())->setTypeImg($v->getType())->setHeight($size[2])->setWidth($size[1])->setContentHash($hash . '.jpg')->setContent(base64_encode($content))->setCreatedAt(date("Y-m-d H:i"))->setUpdatedAt(date("Y-m-d H:i"))->save();
         }
     } catch (Exception $e) {
         echo "stdfdfdfdfrt";
         die;
     }
     $criteria = new Criteria();
     $criteria->add(ImagesPeer::CONTENT_HASH, $obj->getContentHash());
     $obj = ImagesPeer::doSelectOne($criteria);
     return $obj->getId();
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:32,代码来源:ColorForm.class.php

示例13: saveJobeetCategoryAffiliateList

 public function saveJobeetCategoryAffiliateList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['jobeet_category_affiliate_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(JobeetCategoryAffiliatePeer::CATEGORY_ID, $this->object->getPrimaryKey());
     JobeetCategoryAffiliatePeer::doDelete($c, $con);
     $values = $this->getValue('jobeet_category_affiliate_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new JobeetCategoryAffiliate();
             $obj->setCategoryId($this->object->getPrimaryKey());
             $obj->setAffiliateId($value);
             $obj->save();
         }
     }
 }
开发者ID:hira-yahoo,项目名称:Jobeet4,代码行数:25,代码来源:BaseJobeetCategoryForm.class.php

示例14: getallByClassRoom

 public static function getallByClassRoom($classroom_id)
 {
     $c = new Criteria();
     $c->addJoin(ClassroomResourcesPeer::RESOURCE_ID, self::ID);
     $c->add(ClassroomResourcesPeer::CLASSROOM_ID, $classroom_id);
     return self::doSelect($c);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:7,代码来源:ResourcesPeer.php

示例15: getByURI

 /**
  * Get repository by URI
  * @param string $url the url of the repository to find
  * @return QubitQuery collection of OAI-PMH Repositories
  */
 public static function getByURI($URI)
 {
     $criteria = new Criteria();
     $criteria->add(QubitOaiRepository::URI, $URI, Criteria::LIKE);
     $criteria->addAscendingOrderByColumn(QubitOaiRepository::NAME);
     return self::get($criteria);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:12,代码来源:QubitOaiRepository.php


注:本文中的Criteria类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。