Exemplo n.º 1
0
 public function countAction()
 {
     $nbr = 0;
     if ($device_uid = $this->getRequest()->getParam('device_uid')) {
         $message = new Push_Model_Message();
         $message->setMessageTypeByOptionValue($this->getCurrentOptionValue()->getOptionId());
         $nbr = $message->countByDeviceId($device_uid);
     }
     $data = array('count' => $nbr);
     $this->_sendHtml($data);
 }
Exemplo n.º 2
0
 public function countAction()
 {
     $html = array();
     $device_uid = $this->_getDeviceUid();
     $nbr = 0;
     if ($device_uid) {
         $message = new Push_Model_Message();
         $nbr = $message->countByDeviceId($device_uid);
     }
     $html = array('count' => $nbr);
     $this->getLayout()->setHtml(Zend_Json::encode($html));
 }
Exemplo n.º 3
0
 /**
  * Register Device
  *
  */
 public function registerdeviceAction()
 {
     if ($params = $this->getRequest()->getParams()) {
         $fields = array('app_id', 'app_name', 'app_version', 'device_uid', 'device_token', 'device_name', 'device_model', 'device_version', 'push_badge', 'push_alert', 'push_sound');
         foreach ($params as $key => $value) {
             if (!in_array($key, $fields)) {
                 unset($params[$key]);
             }
         }
         $params['status'] = 'active';
         $device = new Push_Model_Iphone_Device();
         $device->find($params['device_token'], 'device_token');
         $device->addData($params)->save();
         $message = new Push_Model_Message();
         $this->getLayout()->setHtml($message->countByDeviceId($device->getDeviceUid()));
     }
 }