Пример #1
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);
 }
Пример #2
0
 public function findbyadminAction()
 {
     $data = array("app_ids" => array(), "is_allowed_to_add_pages" => array());
     $application = new Application_Model_Application();
     if (!Siberian_Version::is("sae")) {
         $applications = $application->findAllByAdmin($this->getRequest()->getParam("admin_id"));
     } else {
         $applications = array(Application_Model_Application::getInstance());
     }
     foreach ($applications as $application) {
         $data["app_ids"][] = $application->getId();
         if ($application->getIsAllowedToAddPages()) {
             $data["is_allowed_to_add_pages"][] = $application->getId();
         }
     }
     $this->_sendHtml($data);
 }