openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

IndexManifestAction.class.php (1897B)


      1 <?php
      2 namespace cms\ui\action\index;
      3 use cms\action\Method;
      4 use cms\base\Configuration;
      5 use cms\ui\action\IndexAction;
      6 use cms\ui\themes\ThemeStyle;
      7 use util\Session;
      8 use cms\action\RequestParams;
      9 use cms\auth\Auth;
     10 use cms\auth\AuthRunner;
     11 use cms\base\Configuration as C;
     12 use cms\base\Startup;
     13 use cms\model\BaseObject;
     14 use cms\model\Project;
     15 use cms\model\User;
     16 use cms\model\Value;
     17 use cms\ui\themes\Theme;
     18 use Exception;
     19 use language\Messages;
     20 use util\Html;
     21 use util\json\JSON;
     22 use logger\Logger;
     23 use util\Less;
     24 use util\UIUtils;
     25 use \util\exception\ObjectNotFoundException;
     26 
     27 
     28 /**
     29  * Creating the website manifest.
     30  *
     31  * See https://developer.mozilla.org/de/docs/Web/Manifest
     32  */
     33 class IndexManifestAction extends IndexAction implements Method {
     34 
     35     public function view() {
     36         $user = $this->currentUser;
     37 
     38         if   ( $user )
     39             $this->lastModified( C::subset('config')->get('last_modification_time',time() ) );
     40         else
     41             $this->lastModified( time() );
     42 
     43         $currentStyle = $this->getUserStyle( $user );
     44 
     45 		$themeStyle = new ThemeStyle( Configuration::subset('style')->get($currentStyle,[]) ); // user style config
     46 
     47 
     48 		// Theme base color for smartphones colorizing their status bar.
     49         $themeColor = UIUtils::getColorHexCode($themeStyle->getThemeColor());
     50 
     51         $appName = C::subset(['application'])->get('name',Startup::TITLE);
     52 
     53         $value = array(
     54             'name'        => $appName,
     55             'description' => $appName,
     56             'short_name'  => 'CMS',
     57             'display'     => 'standalone',
     58             'orientation' => 'landscape',
     59             'background_color' => $themeColor,
     60             'theme_color' => $themeColor,
     61 			'start_url'   => './',
     62         );
     63 
     64         header("Content-Type: application/manifest+json");
     65 		$this->setTemplateVar( 'manifest',JSON::encode($value) );
     66     }
     67 
     68 
     69     public function post() {
     70     }
     71 }