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


PHP Contacts::find方法代码示例

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


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

示例1: addMoreContactAction

 public function addMoreContactAction()
 {
     if ($this->request->isPost() == true) {
         $group_id = $this->request->getPost('group_id');
         $user_id = $this->request->getPost('user_id');
         $groucontact = GroupContact::find("group_id={$group_id}");
         $contact_ids = array();
         foreach ($groucontact as $contact) {
             $contact_ids[] = $contact->contact_id;
         }
         $contacts = '';
         $contacts = implode(',', $contact_ids);
         if (count($contact_ids) > 0) {
             $other_contacts = Contacts::find(array('conditions' => 'id NOT IN (' . $contacts . ') AND user_id=' . $user_id . ' AND deleted=0', 'columns' => 'id,name,number,email'));
         } else {
             $other_contacts = Contacts::find(array('conditions' => 'user_id=' . $user_id . ' AND deleted=0', 'columns' => 'id,name,number,email'));
         }
         $morecontacts = array();
         foreach ($other_contacts as $other_contact) {
             $morecontacts[] = array('id' => $other_contact->id, 'name' => $other_contact->name, 'number' => $other_contact->number, 'email' => $other_contact->email);
         }
         $this->response->setContent(json_encode(array('morecontacts' => $morecontacts)));
         // $this->flash->error($other_contacts->getMessages());
         $this->response->send();
     } else {
     }
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:27,代码来源:GroupController.php

示例2: deletecontactAction

 /**
  * deleteAction
  * Delete a contact of the customer
  * @return unknown_type
  */
 public function deletecontactAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (is_numeric($id)) {
         Contacts::find($id)->delete();
     }
     $this->_helper->redirector('account', 'profile', 'default');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:13,代码来源:ProfileController.php

示例3: deleteContactAction

 public function deleteContactAction()
 {
     if ($this->request->isPost() == true) {
         $this->response->setContentType('application/json');
         $user_id = $this->request->getPost('user_id');
         $contact_ids = $this->request->getPost('contact_ids');
         $contacts = Contacts::find('id IN (' . $contact_ids . ')');
         foreach ($contacts as $contact) {
             $group_contacts = GroupContact::find('contact_id =' . $contact->id);
             if ($group_contacts != false) {
                 foreach ($group_contacts as $group_contact) {
                     $group_contact->delete();
                 }
             }
             $contact->deleted = 1;
             $contact->save();
         }
         $data = array('status' => 'success', 'msg' => 'contact deleted', 'code' => 2);
         $this->response->setContent(json_encode($data));
         $this->response->send();
     }
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:22,代码来源:UserController.php

示例4: sheduleSMSAction

 public function sheduleSMSAction()
 {
     if ($this->request->isPost() == true) {
         $this->response->setContentType('application/json');
         $type = $this->request->getPost('type');
         $user_id = $this->request->getPost('user_id');
         $message = $this->request->getPost('message');
         $datetime = $this->request->getPost('datetime');
         $timezone = 'UTC';
         $scheduled_date_user_tz = new DateTime($datetime, new DateTimeZone($timezone));
         $scheduled_date_user_tz->setTimezone(new DateTimeZone('UTC'));
         $scheduled_date_UTC = $scheduled_date_user_tz->format('Y-m-d H:i:s');
         $schedule_date = date('Y-m-d H:i:s', strtotime($scheduled_date_UTC));
         // $scheduled_date_user_tz = new DateTime($datetime);
         // $scheduled_date_UTC = $scheduled_date_user_tz->format('Y-m-d H:i:s');
         // $schedule_date = date('Y-m-d H:i:s', strtotime($scheduled_date_UTC));
         if ($type == "CONTACTID") {
             $contact_ids = $this->request->getPost('contact_ids');
             $contacts_ids = explode(',', $contact_ids);
             $contacts = Contacts::find('id IN (' . $contact_ids . ')');
             $numbers = array();
             $contact_id = array();
             foreach ($contacts as $contact) {
                 $numbers[] = $contact->number;
                 $contact_id[] = $contact->id;
             }
         }
         if ($type == "GROUPID") {
             $group_id = $this->request->getPost('group_id');
             $groucontact = GroupContact::find("group_id={$group_id}");
             $groucontactlist = array();
             $contact_id = array();
             foreach ($groucontact as $group_data) {
                 $numbers[] = $group_data->contacts->number;
             }
             $contact_id = explode(',', $group_id);
         }
         $data = $this->sheduleSMSProcessData(array('message' => $message, 'user_id' => $user_id, 'ids' => $contact_id, 'type' => $type, 'contacts' => $numbers, 'schedule_date' => $schedule_date));
         $this->response->setContent(json_encode($data));
         $this->response->send();
     }
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:42,代码来源:SmsController.php


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