コード例 #1
0
 /**
  * Get device features
  * 
  * @return Application_Model_Device
  */
 public function getDevice()
 {
     if ($this->device == null) {
         $this->device = false;
         $devices = Application_Model_DevicesMapper::i()->fetchAll();
         /* @var Application_Model_Device $device */
         foreach ($devices as $device) {
             // if exact do an == comparison
             if ($device->isExact() && $device->getPattern() == $_SERVER['HTTP_USER_AGENT'] || !$device->isExact() && preg_match($device->getPattern(), $_SERVER['HTTP_USER_AGENT']) > 0) {
                 // valid $device found;
                 $this->device = $device;
                 break;
             }
         }
         if ($this->device == false) {
             // load things from default
             $this->device = new Application_Model_Device();
             if (X_VlcShares_Plugins::broker()->isRegistered('wiimc')) {
                 $this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WiimcPlxRenderer'));
             } else {
                 $this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WebkitRenderer'));
             }
             $this->device->setIdProfile($this->options->get('profile', 1))->setLabel("Unknown device");
         }
     }
     return $this->device;
 }
コード例 #2
0
 public function findAction()
 {
     $application = Application_Model_Application::getInstance();
     $admin = new Admin_Model_Admin();
     if (Siberian_Version::is("sae")) {
         $admins = $admin->findAll()->toArray();
         $admin_owner = $admin;
         $admin_owner->setData(current($admins));
     } else {
         $admins = $admin->getAllApplicationAdmins($this->getRequest()->getParam("app_id"));
         $admin_owner = $application->getOwner();
     }
     $admin_list = array();
     foreach ($admins as $admin) {
         $admin_list[] = $admin;
     }
     $admin = array("name" => $admin_owner->getFirstname() . " " . $admin_owner->getLastname(), "email" => $admin_owner->getEmail(), "company" => $admin_owner->getCompany(), "phone" => $admin_owner->getPhone());
     $store_categories = Application_Model_Device_Ios::getStoreCategeories();
     $devices = array();
     foreach ($application->getDevices() as $device) {
         $device->setName($device->getName());
         $device->setBrandName($device->getBrandName());
         $device->setStoreName($device->getStoreName());
         $device->setHasMissingInformation(!$device->getUseOurDeveloperAccount() && (!$device->getDeveloperAccountUsername() || !$device->getDeveloperAccountPassword()));
         $devices[] = $device->getData();
     }
     $data = array('admin' => $admin, 'admin_list' => $admin_list, 'app_store_icon' => $application->getAppStoreIcon(), 'google_play_icon' => $application->getGooglePlayIcon(), 'devices' => $devices, 'url' => $application->getUrl(), 'has_ios_certificate' => Push_Model_Certificate::getiOSCertificat() !== null);
     foreach ($store_categories as $name => $store_category) {
         if ($store_category->getId() == $application->getMainCategoryId()) {
             $data['main_category_name'] = $name;
         } else {
             if ($store_category->getId() == $application->getSecondaryCategoryId()) {
                 $data['secondary_category_name'] = $name;
             }
         }
     }
     $folder_name = $application->getDevice(2)->getTmpFolderName();
     $apk_path = null;
     $date_mod = null;
     if ($folder_name != "") {
         $apk_base_path = Core_Model_Directory::getBasePathTo("var/tmp/applications/android/{$folder_name}/Siberian/app/build/outputs/apk/app-release.apk");
     }
     if (file_exists($apk_base_path)) {
         $apk_path = Core_Model_Directory::getPathTo("var/tmp/applications/android/{$folder_name}/Siberian/app/build/outputs/apk/app-release.apk");
         $date = new Zend_Date(filemtime($apk_base_path), Zend_Date::TIMESTAMP);
         $date_mod = $date->toString($this->_("MM/dd/y 'at' hh:mm a"));
     }
     $data["bundle_id"] = $application->getBundleId();
     $data["is_active"] = $application->isActive();
     $data["is_locked"] = $application->isLocked();
     $data["can_be_published"] = $application->canBePublished();
     if ($application->getFreeUntil()) {
         $date = new Zend_Date($application->getFreeUntil(), Zend_Date::ISO_8601);
         $data["free_until"] = $date->toString("MM/dd/yyyy");
     }
     $data["apk"] = array("link" => $apk_path, 'date' => $date_mod);
     $application->addData($data);
     $data = array("application" => $application->getData(), 'statuses' => Application_Model_Device::getStatuses());
     $this->_sendHtml($data);
 }
コード例 #3
0
 public function generateAction()
 {
     if ($datas = $this->getRequest()->getParams()) {
         try {
             if (empty($datas['device_id'])) {
                 throw new Exception("L'application recherchée n'existe pas");
             }
             $device_id = $datas['device_id'];
             $device = new Application_Model_Device(array('device_id' => $device_id));
             $zip = $device->getResources();
             $path = explode('/', $zip);
             end($path);
             $this->_download($zip, current($path), 'application/octet-stream');
         } catch (Exception $e) {
             Zend_Debug::dump($e);
         }
         die('ok');
     }
 }
コード例 #4
0
ファイル: CatalogController.php プロジェクト: vitaliy5118/ss1
 public function editAction()
 {
     // action body
     $form = new Application_Form_Devices();
     $form->submit->setLabel('Редактировать');
     $_SESSION['edit'] = true;
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             //Успешная валидация
             //Извлекаем данные в обьект
             $device = new Application_Model_Device($form);
             //Редактируем данные в базе
             $device->edit();
             $this->_helper->redirector('index');
         } else {
             //Неуспешная валидация
             //Возвращаем данные в таблицу
             $form->populate($formData);
         }
     } else {
         $id = $this->getParam('id');
         $device = new Application_Model_DbTable_Devices();
         $form->populate($device->getDevice($id));
     }
 }
コード例 #5
0
 public function getDevice($device_id)
 {
     if (empty($this->_devices[$device_id])) {
         $device = new Application_Model_Device();
         $device->find(array("app_id" => $this->getId(), "type_id" => $device_id));
         if (!$device->getId()) {
             $device->loadDefault($device_id);
             $device->setAppId($this->getId());
         }
         $this->_devices[$device_id] = $device;
     }
     return $this->_devices[$device_id];
 }
コード例 #6
0
ファイル: Outlets.php プロジェクト: vitaliy5118/ss1
 public function editDevice(Application_Model_Device $device)
 {
     // редактируем запись
     $this->update($device->makearray(), 'id=' . (int) $device->id);
 }
コード例 #7
0
 public function delete(Application_Model_Device $model)
 {
     if ($model->getId()) {
         $this->getDbTable()->delete(array('id = ?' => $model->getId()));
     }
 }