コード例 #1
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executePbContactDelete()
 {
     $this->userInit();
     $user_id = $this->user->getAttribute('user_id', null, 'bo');
     $param = $this->getAllRequestParameter();
     if (empty($param['id'])) {
         $this->jsonwrapper->show_json_error('#empty i', 'Missing id parameter');
     } else {
         $contactCriteria = new Criteria();
         $contactCriteria->add(SmsPbPeer::ID, $param['id'], Criteria::EQUAL);
         $contactCriteria->add(SmsPbGroupPeer::CREATOR_USER_ID, $user_id, Criteria::EQUAL);
         $contactCriteria->add(SmsPbGroupPeer::CREATOR_TYPE, $this->userType, Criteria::EQUAL);
         $contact = SmsPbPeer::doSelectOne($contactCriteria);
         if (!$contact) {
             $this->jsonwrapper->show_json_error('contact not found', 'Sorry, you cannot delete this contact 1.');
         } else {
             if ($contact->getSmsPbGroup()->getCreatorUserId() != $user_id) {
                 $this->jsonwrapper->show_json_error('contact not found', 'Sorry, you cannot delete this contact 2.');
             }
             $contact->delete();
             $this->jsonwrapper->print_json(array('success' => 1, 'data' => $contact->toArray()));
         }
     }
 }
コード例 #2
0
ファイル: BaseSmsPb.php プロジェクト: taryono/school
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = SmsPbPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setGroupId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setName($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setPhoneNumber($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCreated($arr[$keys[4]]);
     }
 }
コード例 #3
0
ファイル: BaseSmsPbGroup.php プロジェクト: taryono/school
 public function countSmsPbs($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseSmsPbPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(SmsPbPeer::GROUP_ID, $this->getId());
     return SmsPbPeer::doCount($criteria, $distinct, $con);
 }
コード例 #4
0
ファイル: BaseSmsPbPeer.php プロジェクト: taryono/school
 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;
 }
コード例 #5
0
ファイル: smsContact.php プロジェクト: taryono/school
 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;
 }