public static function retrieveOrCreateByCareerSubjectAndStudent($career_subject_id, $student_id) { $c = new Criteria(); $c->add(self::CAREER_SUBJECT_ID, $career_subject_id); $c->add(self::STUDENT_ID, $student_id); $sacs = self::doSelectOne($c); if ($sacs == null) { $criteria = new criteria(); $criteria->add(CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID, $career_subject_id); $career_subject_school_years = CareerSubjectSchoolYearPeer::doSelect($criteria); $opcions = array(); foreach ($career_subject_school_years as $career_subject_school_year) { foreach ($career_subject_school_year->getChoices() as $optional_career_subject_school_year) { $cs = CareerSubjectPeer::retrieveByCareerSubjectSchoolYearId($optional_career_subject_school_year->getChoiceCareerSubjectSchoolYearId()); $opcions[] = $cs->getId(); } } $criteria = new criteria(); $criteria->add(self::CAREER_SUBJECT_ID, $opcions, Criteria::IN); $sacs = self::doSelectOne($criteria); if ($sacs == null) { $sacs = new StudentApprovedCareerSubject(); $sacs->setCareerSubjectId($career_subject_id); } } $sacs->setStudentId($student_id); return $sacs; }
function b_yogurt_lastpictures_show($options) { global $xoopsDB, $xoopsModule, $xoopsModuleConfig; $myts =& MyTextSanitizer::getInstance(); $block = array(); /** * Filter for fetch votes ishot and isnothot */ $criteria = new criteria('cod_img', 0, ">"); $criteria->setSort("cod_img"); $criteria->setOrder("DESC"); $criteria->setLimit($options[0]); /** * Creating factories of pictures and votes */ //$album_factory = new Xoopsyogurt_imagesHandler($xoopsDB); $pictures_factory = new Xoopsyogurt_imagesHandler($xoopsDB); $block = $pictures_factory->getLastPicturesForBlock($options[0]); return $block; }
public function getStatement($criteria) { $s = criteria::getOperand($this->attribute, $criteria)->getSqlOrder(); $s .= $this->ascend ? ' ASC' : ' DESC'; return $s; }
public function __construct($operand, $criteria) { parent::__construct($operand); $this->type = 'public function'; $str = $this->argument = $this->operand; $separator = "+-/*,()"; $tok = strtok($str, $separator); while ($tok) { $t[$tok] = $tok; $tok = strtok($separator); } foreach ($t as $token) { $op = criteria::getOperand($token, $criteria); if (get_class($op) == 'OperandValue') { $op = criteria::getOperand(':' . $token, $criteria); } $this->argument = str_replace($token, $op->getSql(), $this->argument); } }
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include_once '../../mainfile.php'; $xoopsOption['template_main'] = 'yogurt_seutubo.html'; include_once '../../header.php'; include_once 'class/yogurt_controler.php'; $controler = new YogurtVideoControler($xoopsDB, $xoopsUser); /** * Fecthing numbers of tribes friends videos pictures etc... */ $nbSections = $controler->getNumbersSections(); $start = isset($_GET['start']) ? intval($_GET['start']) : 0; /** * Criteria for Videos */ $criteriaUidVideo = new criteria('uid_owner', $controler->uidOwner); $criteriaUidVideo->setStart($start); $criteriaUidVideo->setLimit($xoopsModuleConfig['videosperpage']); /** * Get all videos of this user and assign them to template */ $videos = $controler->getVideos($criteriaUidVideo); $videos_array = $controler->assignVideoContent($nbSections['nbVideos'], $videos); if (is_array($videos_array)) { $xoopsTpl->assign('videos', $videos_array); } else { $xoopsTpl->assign('lang_novideoyet', _MD_YOGURT_NOVIDEOSYET); } $pageNav = $controler->VideosNavBar($nbSections['nbVideos'], $xoopsModuleConfig['videosperpage'], $start, 2); /** * Adding to the module js and css of the lightbox and new ones
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include_once '../../mainfile.php'; $xoopsOption['template_main'] = 'yogurt_audio.html'; include_once '../../header.php'; include_once 'class/yogurt_controler.php'; $controler = new YogurtAudioControler($xoopsDB, $xoopsUser); /** * Fecthing numbers of tribes friends videos pictures etc... */ $nbSections = $controler->getNumbersSections(); $start = isset($_GET['start']) ? intval($_GET['start']) : 0; /** * Criteria for Audio */ $criteriaUidAudio = new criteria('uid_owner', $controler->uidOwner); $criteriaUidAudio->setStart($start); $criteriaUidAudio->setLimit($xoopsModuleConfig['audiosperpage']); /** * Get all audios of this user and assign them to template */ $audios = $controler->getAudio($criteriaUidAudio); $audios_array = $controler->assignAudioContent($nbSections['nbAudio'], $audios); if (is_array($audios_array)) { $xoopsTpl->assign('audios', $audios_array); $audio_list = ''; foreach ($audios_array as $audio_item) { $audio_list .= '../../uploads/yogurt/mp3/' . $audio_item['url'] . ' | '; } //$audio_list = substr($audio_list,-2); $xoopsTpl->assign('audio_list', $audio_list);
static function cleanUp($id) { $c = new criteria(); $c->add(self::PRODUCT_ID, $id); return self::doDelete($c); }
private function check_pvs(EtvaNode $etva_node) { $node_response = $etva_node->soapSend('getpvs_arr', array('force' => 1)); if (!$node_response['success']) { $errors = $node_response['error']; Etva::getLogMessage(array('info' => ''), EtvaPhysicalvolumePeer::_ERR_INCONSISTENT_); //$etva_node->setErrorMessage(EtvaPhysicalvolume_VA::LVINIT); $message = $this->getContext()->getI18N()->__(EtvaPhysicalvolumePeer::_ERR_SOAPUPDATE_, array('%info%' => $node_response['info'])); sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($etva_node->getName(), 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::ERR))); $response = array('success' => false, 'error' => $message, 'agent' => $etva_node->getName()); $return = $this->setJsonError($response); return $this->renderText($return); } //verify if cluster has any logical volume that belongs to another cluster... $cluster_id = $etva_node->getClusterId(); $my_pvs = $node_response['response']; $my_pvs = (array) $my_pvs; foreach ($my_pvs as $my_pv) { $pv_info = (array) $my_pv; if ($pv_info['type'] == EtvaPhysicalvolume::STORAGE_TYPE_LOCAL_MAP) { continue; } $c_uuid = new criteria(); $c_uuid->add(EtvaPhysicalvolumePeer::UUID, $pv_info['uuid']); $c_uuid->addAnd(EtvaPhysicalvolumePeer::CLUSTER_ID, $cluster_id, Criteria::NOT_EQUAL); $e_pv = EtvaPhysicalvolumePeer::doSelectOne($c_uuid); if ($e_pv) { $c_c = new Criteria(); $c_c->add(EtvaClusterPeer::ID, $e_pv->getClusterId()); $etva_cluster = EtvaClusterPeer::doSelectOne($c_c); $msg_i18n = $this->getContext()->getI18N()->__(EtvaPhysicalvolumePeer::_ERR_INIT_OTHER_CLUSTER_, array('%name%' => $etva_cluster->getName())); $response = array('success' => false, 'agent' => sfConfig::get('config_acronym'), 'error' => $msg_i18n, 'info' => $msg_i18n); $return = $this->setJsonError($response); return $this->renderText($return); } } }
public function checkPayId($value, $msg, $bank) { $ctBankOnlinepayPaymentMapper = $this->toolkit->getMapper('ctBank', 'ctBankOnlinepayPayment'); $userMapper = $this->toolkit->getMapper('user', 'user'); $criteria = new criteria(); $criteria->where('pay_id', $value); $criteria->where('bank_id', $bank->getId()); if (!($payment = $ctBankOnlinepayPaymentMapper->searchOneByCriteria($criteria))) { return true; } if ($userMapper->searchByKey($payment->getUserId())->getLogin() == $this->request->getString('ACCOUNT', SC_GET) && $payment->getSum() * 100 == $this->request->getInteger('PAY_AMOUNT', SC_GET)) { $msg = 11; //11 Такой платеж уже был проведен } else { $msg = 10; //10 Был другой платеж с указанным PAY_ID } return false; }
public static function getForExpertCategory($iCategoryId) { $c = new criteria(); $c->addJoin(UserPeer::ID, ExpertCategoryPeer::USER_ID, Criteria::JOIN); $c->add(ExpertCategoryPeer::CATEGORY_ID, $iCategoryId); $c->addDescendingOrderbyColumn(UserPeer::POINTS); $c->setLimit(5); $c->setDistinct(); return UserPeer::doSelect($c); }