當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。