Пример #1
0
 /**
  * save one phone
  * -  if $recordData['id'] is empty the phone gets added, otherwise it gets updated
  *
  * @param array $recordData an array of phone properties
  * @return array
  */
 public function saveMyPhone($recordData)
 {
     $voipController = Phone_Controller_MyPhone::getInstance();
     $phone = new Phone_Model_MyPhone();
     $phone->setFromArray($recordData);
     $phoneSettings = new Voipmanager_Model_Snom_PhoneSettings();
     $phoneSettings->setFromArray($recordData);
     $phone->settings = $phoneSettings;
     $phone->lines = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_Line', isset($recordData['lines']) && !empty($recordData['lines']) ? $recordData['lines'] : array(), TRUE);
     if (!empty($phone->id)) {
         $phone = $voipController->update($phone);
     }
     return $this->getMyPhone($phone->getId());
 }
 /**
  * save user phone
  *
  * @param array $recordData an array of phone properties
  * @return array
  */
 public function saveMyPhone($recordData)
 {
     // close session to allow other requests
     Zend_Session::writeClose(true);
     unset($recordData['template_id']);
     $phone = new Phone_Model_MyPhone();
     $phone->setFromArray($recordData);
     $phoneSettings = new Voipmanager_Model_Snom_PhoneSettings();
     $phoneSettings->setFromArray($recordData);
     $phone->settings = $phoneSettings;
     $phone->lines = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_Line', isset($recordData['lines']) && !empty($recordData['lines']) ? $recordData['lines'] : array(), TRUE);
     if (!empty($phone->id)) {
         $phone = Phone_Controller_MyPhone::getInstance()->update($phone);
     } else {
         // will throw exception in any case
         $phone = Phone_Controller_MyPhone::getInstance()->create($phone);
     }
     return $this->getMyPhone($phone->getId());
 }