コード例 #1
0
ファイル: DataTest.php プロジェクト: natxetee/magento2
 /**
  * @dataProvider getDefaultDesignTabsDataProvider
  */
 public function testGetDefaultDesignTabs($appType)
 {
     $application = new Mage_XmlConnect_Model_Application();
     $application->setType($appType);
     $tabs = $this->_helper->getDeviceHelper($application)->getDefaultDesignTabs();
     $this->assertNotEmpty($tabs);
     foreach ($tabs as $tab) {
         $this->assertArrayHasKey('image', $tab);
     }
 }
コード例 #2
0
ファイル: Configuration.php プロジェクト: cewolf2002/magento
 /**
  * Retrieve initialized instance of XmlConnect application model
  *
  * @return Mage_XmlConnect_Model_Application
  */
 protected function _getConnectApp()
 {
     if (!$this->_connectApp) {
         $this->_connectApp = Mage::helper('xmlconnect')->getApplication();
         if (!$this->_connectApp) {
             $this->_connectApp = Mage::getModel('xmlconnect/application');
             $this->_connectApp->loadDefaultConfiguration();
         }
     }
     return $this->_connectApp;
 }
コード例 #3
0
 /**
  * Set application cookies
  *
  * Set application coolies: application code and device screen size.
  *
  * @param Mage_XmlConnect_Model_Application $app
  * @return void
  */
 protected function _initCookies(Mage_XmlConnect_Model_Application $app)
 {
     $cookieToSetArray = array(array('cookieName' => Mage_XmlConnect_Model_Application::APP_CODE_COOKIE_NAME, 'paramName' => Mage_XmlConnect_Model_Application::APP_CODE_COOKIE_NAME, 'value' => $app->getCode()), array('cookieName' => Mage_XmlConnect_Model_Application::APP_SCREEN_SIZE_NAME, 'paramName' => Mage_XmlConnect_Model_Application::APP_SCREEN_SIZE_NAME, 'value' => $app->getScreenSize()));
     foreach ($cookieToSetArray as $item) {
         if (!isset($_COOKIE[$item['cookieName']]) || $_COOKIE[$item['cookieName']] != $this->getRequest()->getParam($item['paramName'])) {
             /**
              * @todo add management of cookie expire to application admin panel
              */
             $cookieExpireOffset = 3600 * 24 * 30;
             Mage::getSingleton('core/cookie')->set($item['cookieName'], $item['value'], $cookieExpireOffset, '/', null, null, true);
         }
     }
 }
コード例 #4
0
 /**
  * Render block
  *
  * @return string
  */
 protected function _toHtml()
 {
     /** @var $xml Mage_XmlConnect_Model_Simplexml_Element */
     $xml = Mage::getModel('xmlconnect/simplexml_element', '<configuration></configuration>');
     $this->_buildRecursive($xml, Mage::helper('xmlconnect')->excludeXmlConfigKeys($this->_app->getRenderConf()))->_addLocalization($xml);
     return $xml->asNiceXml();
 }
コード例 #5
0
ファイル: Data.php プロジェクト: cnglobal-sl/caterez
 /**
  * Get device tipe from application
  *
  * @param Mage_XmlConnect_Model_Application $application
  * @return string
  */
 public function getDeviceType($application = null)
 {
     $deviceType = null;
     if (empty($application) && Mage::registry('current_app') !== null) {
         $deviceType = (string) $this->getApplication()->getType();
     } elseif ($application instanceof Mage_XmlConnect_Model_Application) {
         $deviceType = (string) $application->getType();
     }
     if (empty($deviceType)) {
         $deviceType = self::DEVICE_TYPE_DEFAULT;
     }
     return $deviceType;
 }
コード例 #6
0
ファイル: Application.php プロジェクト: okite11/frames21
 /**
  * Update all applications "updated at" parameter with current date
  *
  * @param Mage_XmlConnect_Model_Application $model
  * @return Mage_XmlConnect_Model_Resource_Application
  */
 public function updateUpdatedAtParameter($model)
 {
     $this->_getWriteAdapter()->update($this->getMainTable(), array('updated_at' => $model->getUpdatedAt()));
     return $this;
 }
コード例 #7
0
 /**
  * Render block
  *
  * @return string
  */
 protected function _toHtml()
 {
     $xml = new Mage_XmlConnect_Model_Simplexml_Element('<configuration></configuration>');
     $this->_buildRecursive($xml, Mage::helper('xmlconnect')->excludeXmlConfigKeys($this->_app->getRenderConf()));
     return $xml->asNiceXml();
 }
コード例 #8
0
ファイル: Data.php プロジェクト: njaeger/magento_github
 /**
  * Check if creating AirMail template for the application is allowed
  *
  * @param Mage_XmlConnect_Model_Application $application
  * @return boolean
  */
 public static function isTemplateAllowedForApplication($application = null)
 {
     return $application instanceof Mage_XmlConnect_Model_Application ? in_array($application->getType(), array(self::DEVICE_TYPE_IPHONE)) : false;
 }