Пример #1
0
 public function executePbContactGet()
 {
     $this->userInit();
     $user_id = $this->user->getAttribute('user_id', null, 'bo');
     $param = $this->getAllRequestParameter();
     if (empty($param['group_id'])) {
         $this->jsonwrapper->show_json_error('missing group', 'Please insert group id.');
     }
     /* Check Group */
     $groupCriteria = new Criteria();
     $groupCriteria->add(SmsPbGroupPeer::ID, $param['group_id'], Criteria::EQUAL);
     $groupCriteria->add(SmsPbGroupPeer::CREATOR_USER_ID, $user_id, Criteria::EQUAL);
     $groupCriteria->add(SmsPbGroupPeer::CREATOR_TYPE, $this->userType, Criteria::EQUAL);
     $group = SmsPbGroupPeer::doSelectOne($groupCriteria);
     if (!$group) {
         $this->jsonwrapper->show_json_error('group not found', 'Contact Group Not Found.');
     }
     $contactCriteria = new Criteria();
     $contactCriteria->add(SmsPbPeer::GROUP_ID, $group->getId(), Criteria::EQUAL);
     $contactCriteria->addAscendingOrderByColumn(SmsPbPeer::NAME);
     $contact = SmsPbPeer::doSelect($contactCriteria);
     $output = array();
     foreach ($contact as $c) {
         $output[] = $c->toArray();
     }
     $this->jsonwrapper->print_json(array('success' => 1, 'data' => $output));
 }
Пример #2
0
 public function getSmsPbs($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseSmsPbPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collSmsPbs === null) {
         if ($this->isNew()) {
             $this->collSmsPbs = array();
         } else {
             $criteria->add(SmsPbPeer::GROUP_ID, $this->getId());
             SmsPbPeer::addSelectColumns($criteria);
             $this->collSmsPbs = SmsPbPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(SmsPbPeer::GROUP_ID, $this->getId());
             SmsPbPeer::addSelectColumns($criteria);
             if (!isset($this->lastSmsPbCriteria) || !$this->lastSmsPbCriteria->equals($criteria)) {
                 $this->collSmsPbs = SmsPbPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastSmsPbCriteria = $criteria;
     return $this->collSmsPbs;
 }
Пример #3
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(SmsPbPeer::ID, $pks, Criteria::IN);
         $objs = SmsPbPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #4
0
 public function getPbGroupContactAvailable($idArray, $userId, $userType)
 {
     $groupAvailable = $this->getPbGroupAvailable($userId, $userType, $idArray);
     if (!$groupAvailable) {
         return false;
     }
     $criteria = new Criteria();
     $criteria->add(SmsPbPeer::GROUP_ID, $groupAvailable, Criteria::IN);
     $result = SmsPbPeer::doSelect($criteria);
     return $result;
 }