public function run()
 {
     //TODO: Language detection
     /*$conf = new Config($this);
     		if ($this->managers()->get('File')->exists('~/.config/locale.xml')) {
     			$conf->load('~/.config/locale.xml');
     		}
     		if ($conf->exist('language')) {
     			$this->managers()->get('Translation')->setLanguage($conf->get('language'));
     		} else {
     			$lang = $this->managers()->get('Translation')->detectLanguage();
     			if ($this->user->isConnected()) {
     				$conf->set('language', $lang);
     				$conf->save('~/.config/locale.xml');
     			}
     		}*/
     $jsIncludes = $this->_getIncludes();
     $t = new TranslationDictionary();
     ob_start();
     //Include layout (basic HTML structure)
     require 'boot/includes/layout.php';
     $out = ob_get_contents();
     ob_end_clean();
     $resp = new RawResponse();
     $resp->setValue($out);
     $this->httpResponse->addHeader('Content-Type: text/html');
     $this->httpResponse->setContent($resp);
 }
예제 #2
0
 public function run()
 {
     $fileManager = $this->managers->getManagerOf('file');
     $configManager = $this->managers->getManagerOf('config');
     if (!$this->httpRequest->getExists('type')) {
         $this->httpResponse()->addHeader('HTTP/1.0 400 Bad Request');
         throw new \RuntimeException('No manifest specified');
     }
     $manifestType = $this->httpRequest->getData('type');
     if (!isset($this->manifestsPaths[$manifestType])) {
         $this->httpResponse()->addHeader('HTTP/1.0 404 Not Found');
         throw new \RuntimeException('Invalid manifest type');
     }
     $manifestPath = $this->manifestsPaths[$manifestType];
     $manifestFile = $configManager->open($manifestPath);
     $manifest = $manifestFile->read();
     if ($manifestType == 'firefox') {
         if (isset($_SERVER['SERVER_NAME'])) {
             $manifest['name'] .= ' · ' . $_SERVER['SERVER_NAME'];
         }
         //$manifest['version'] = $fileManager->read(self::WEBOS_VERSION_FILE);
         if (isset($_SERVER['REQUEST_URI'])) {
             $manifest['launch_path'] = preg_replace('#\\/webos\\.webapp$#', '', $_SERVER['REQUEST_URI']);
         }
     }
     $manifestStr = json_encode($manifest);
     $this->httpResponse->setCacheable();
     $this->httpResponse->addHeader('Content-Type: ' . $fileManager->mimetype($manifestPath));
     $this->httpResponse->addHeader('Content-Length: ' . strlen($manifestStr));
     $resp = new RawResponse();
     $resp->setValue($manifestStr);
     $this->httpResponse->setContent($resp);
 }
예제 #3
0
 /**
  * Save news entry order
  * @role sort
  * @return RawResponse
  */
 public function saveOrder()
 {
     $order = array_reverse($this->request->get('newsList'));
     foreach ($order as $key => $value) {
         $update = new ARUpdateFilter();
         $update->setCondition(new EqualsCond(new ARFieldHandle('NewsPost', 'ID'), $value));
         $update->addModifier('position', $key);
         ActiveRecord::updateRecordSet('NewsPost', $update);
     }
     $resp = new RawResponse();
     $resp->setContent($this->request->get('draggedId'));
     return $resp;
 }
예제 #4
0
 public function __construct(SimpleXMLElement $xml)
 {
     parent::__construct($xml->asXML());
     $this->setHeader('Content-type', 'text/xml');
 }
예제 #5
0
 /**
  * Save image order
  * @return RawResponse
  */
 public function saveOrder($order = null)
 {
     $ownerId = $this->request->get('ownerId');
     if ($order === null) {
         $varName = array_shift(explode('_', $this->request->get('draggedID')));
         $order = array_filter($this->request->get($varName . '_' . $ownerId), array($this, 'filterOrder'));
         $order = array_values($order);
     }
     foreach ($order as $key => $value) {
         $update = new ARUpdateFilter();
         $update->setCondition(new EqualsCond(new ARFieldHandle($this->getModelClass(), 'ID'), $value));
         $update->addModifier('position', $key);
         ActiveRecord::updateRecordSet($this->getModelClass(), $update);
     }
     // set owners main image
     if (isset($order[0])) {
         $owner = ActiveRecordModel::getInstanceByID($this->getOwnerClass(), $ownerId);
         $owner->defaultImage->set(ActiveRecordModel::getInstanceByID($this->getModelClass(), $order[0]));
         $owner->save();
     }
     $resp = new RawResponse();
     $resp->setContent($this->request->get('draggedId'));
     return $resp;
 }
예제 #6
0
 public function sortActions()
 {
     $order = $this->request->get('actionContainer_' . $this->request->get('conditionId'));
     foreach ($order as $key => $value) {
         $update = new ARUpdateFilter();
         $update->setCondition(new EqualsCond(new ARFieldHandle('DiscountAction', 'ID'), $value));
         $update->addModifier('position', $key);
         ActiveRecord::updateRecordSet('DiscountAction', $update);
     }
     $resp = new RawResponse();
     $resp->setContent($this->request->get('draggedId'));
     return $resp;
 }
예제 #7
0
 /**
  * Debug method: outputs category tree structure
  *
  */
 public function viewTree()
 {
     $response = new RawResponse(Category::getInstanceByID(ActiveTreeNode::ROOT_ID, true)->toString());
     $response->setHeader('Content-type', 'text/plain');
     return $response;
 }
예제 #8
0
 function __construct($rawResponse, $status, object $error)
 {
     parent::__construct($rawResponse);
     $this->setStatus($status);
     $this->setError($error);
     $this->setIsError(true);
 }