Exemplo n.º 1
0
 public function __construct($key, $label = '', $tooltip = '', $representation = null, $defaultValue = '', $reloadPageOnChange = true, $reloadPropertiesOnChange = false, $options = null)
 {
     parent::__construct($key, $label, $tooltip, $representation);
     $this->defaultValue = $defaultValue;
     $this->reloadPageOnChange = $reloadPageOnChange;
     $this->reloadPropertiesOnChange = $reloadPropertiesOnChange;
     $this->options = $options;
     $this->rawValue = isset($_GET[$this->key]) ? $_GET[$this->key] : $this->defaultValue;
     if (!is_null(Data::getValueFromKey($this->key))) {
         $this->rawValue = Data::getValueFromKey($this->key);
     }
     $this->setValue($this->rawValue);
 }
Exemplo n.º 2
0
 public function __construct($config = array())
 {
     $client_id = isset($config[ContentTemplateRPC::PROPERTY_KEY]) ? $config[ContentTemplateRPC::PROPERTY_KEY] : null;
     $client_secret = isset($config[ContentTemplateRPC::SECRET]) ? $config[ContentTemplateRPC::SECRET] : null;
     if (isset($config[ContentTemplateRPC::CONTENT_RELOAD_PAGE_DELAY])) {
         $this->reloadPageDelay = $config[ContentTemplateRPC::CONTENT_RELOAD_PAGE_DELAY];
     }
     if (isset($config[ContentTemplateRPC::CONTENT_CLICK_THROUGH])) {
         $this->requireUserInput = $config[ContentTemplateRPC::CONTENT_CLICK_THROUGH];
     }
     if (isset($config[ContentTemplateRPC::ENRICHMENT_DEACTIVATION_DELAY])) {
         $this->deactivationDelay = $config[ContentTemplateRPC::ENRICHMENT_DEACTIVATION_DELAY];
     }
     if (isset($config[ContentTemplateRPC::ADWAYS_CONTENT_JS_LIB])) {
         $this->adwaysContentJSLib = $config[ContentTemplateRPC::ADWAYS_CONTENT_JS_LIB];
     }
     if (isset($config[ContentTemplateRPC::ADWAYS_SERVICES_PATH])) {
         $this->adwaysServicesPath = $config[ContentTemplateRPC::ADWAYS_SERVICES_PATH];
     }
     $this->client = new Client($client_id, $client_secret);
     $adwRequestType = isset($_GET[ContentTemplateRPC::REQUEST_TYPE]) ? $_GET[ContentTemplateRPC::REQUEST_TYPE] : RequestTypes::UNDEFINED;
     if ($adwRequestType == ContentTemplateRPC::REQUEST_TYPE_PROPERTIES) {
         $this->requestProperties = true;
     }
     $this->environment = new Environment();
     $propertyId = isset($_GET[ContentTemplateRPC::PROPERTY_ID]) ? $_GET[ContentTemplateRPC::PROPERTY_ID] : null;
     if (!is_null($propertyId)) {
         $this->data = $this->loadProperties($propertyId);
         /**** Chargement des properties, on ajoute chaque property trouvé dans un singleton ****/
         $properties_json = isset($this->data[ContentTemplateRPC::CONTENT_PROPERTIES]) ? $this->data[ContentTemplateRPC::CONTENT_PROPERTIES] : $this->data;
         Data::loadPool($properties_json);
         if (isset($this->data[ContentTemplateRPC::META_DATA])) {
             $this->environment->setMetaData($this->data[ContentTemplateRPC::META_DATA]);
         }
         if (isset($this->data[ContentTemplateRPC::USER]) && isset($this->data[ContentTemplateRPC::USER][ContentTemplateRPC::LANGUAGE])) {
             $this->environment->setLanguage($this->data[ContentTemplateRPC::USER][ContentTemplateRPC::LANGUAGE]);
         }
     }
     $this->refWidth = isset($_GET[ContentTemplateRPC::REF_WIDTH]) ? $_GET[ContentTemplateRPC::REF_WIDTH] : NAN;
     $this->refHeight = isset($_GET[ContentTemplateRPC::REF_HEIGHT]) ? $_GET[ContentTemplateRPC::REF_HEIGHT] : NAN;
     $this->generalNodeSet = new DefaultNodeSet('generalNodeSet', 'general', 'general', Representations::_DEFAULT, '', false, false, Categories::GENERAL);
     $this->properties[] = $this->generalNodeSet;
     $this->contentNodeSet = new DefaultNodeSet('contentNodeSet', 'content', 'content', Representations::_DEFAULT, '', false, false, Categories::CONTENT);
     $this->properties[] = $this->contentNodeSet;
     $this->designNodeSet = new DefaultNodeSet('designNodeSet', 'design', 'design', Representations::_DEFAULT, '', false, false, Categories::DESIGN);
     $this->properties[] = $this->designNodeSet;
     if ($this->requestProperties) {
         header('Content-type: application/json');
         ob_start();
     }
 }
Exemplo n.º 3
0
 public function __construct($config = array())
 {
     $client_id = isset($config[ContentTemplateRPC::PROPERTY_KEY]) ? $config[ContentTemplateRPC::PROPERTY_KEY] : null;
     $client_secret = isset($config[ContentTemplateRPC::SECRET]) ? $config[ContentTemplateRPC::SECRET] : null;
     if (isset($config[ContentTemplateRPC::REFRESH_INTERVAL])) {
         $this->refreshInterval = $config[ContentTemplateRPC::REFRESH_INTERVAL];
     }
     if (isset($config[ContentTemplateRPC::CALLBACK_STRING])) {
         $this->callbackString = $config[ContentTemplateRPC::CALLBACK_STRING];
     }
     if (isset($config[ContentTemplateRPC::ADWAYS_CONTENT_JS_LIB])) {
         $this->adwaysContentJSLib = $config[ContentTemplateRPC::ADWAYS_CONTENT_JS_LIB];
     }
     if (isset($config[ContentTemplateRPC::ADWAYS_SERVICES_PATH])) {
         $this->adwaysServicesPath = $config[ContentTemplateRPC::ADWAYS_SERVICES_PATH];
     }
     $this->client = new Client($client_id, $client_secret);
     $adwRequestType = isset($_GET[ContentTemplateRPC::REQUEST_TYPE]) ? $_GET[ContentTemplateRPC::REQUEST_TYPE] : RequestTypes::UNDEFINED;
     if ($adwRequestType == ContentTemplateRPC::REQUEST_TYPE_PROPERTIES) {
         $this->requestProperties = true;
     }
     $this->environment = new Environment();
     $propertyId = isset($_GET[ContentTemplateRPC::PROPERTY_ID]) ? $_GET[ContentTemplateRPC::PROPERTY_ID] : null;
     if (!is_null($propertyId)) {
         $this->data = $this->loadProperties($propertyId);
         /* Chargement des properties, on ajoute chaque property trouvé dans un singleton */
         $properties_json = isset($this->data[ContentTemplateRPC::CONTENT_PROPERTIES]) ? $this->data[ContentTemplateRPC::CONTENT_PROPERTIES] : $this->data;
         Data::loadPool($properties_json);
         if (isset($this->data[ContentTemplateRPC::PROJECT]) && isset($this->data[ContentTemplateRPC::PROJECT][ContentTemplateRPC::CURRENT]) && isset($this->data[ContentTemplateRPC::PROJECT][ContentTemplateRPC::CURRENT][ContentTemplateRPC::MEDIA])) {
             $this->media = $this->data[ContentTemplateRPC::PROJECT][ContentTemplateRPC::CURRENT][ContentTemplateRPC::MEDIA];
         }
         if (isset($this->data[ContentTemplateRPC::META_DATA])) {
             $this->environment->setMetaData($this->data[ContentTemplateRPC::META_DATA]);
         }
         if (isset($this->data[ContentTemplateRPC::USER]) && isset($this->data[ContentTemplateRPC::USER][ContentTemplateRPC::LANGUAGE])) {
             $this->environment->setLanguage($this->data[ContentTemplateRPC::USER][ContentTemplateRPC::LANGUAGE]);
         }
     }
     //        $this->generalNodeSet = new DefaultNodeSet('generalNodeSet', 'general', 'general', Representations::_DEFAULT, '', false, false, Categories::GENERAL);
     //        $this->properties[] = $this->generalNodeSet;
     //        $this->contentNodeSet = new DefaultNodeSet('contentNodeSet', 'content', 'content', Representations::_DEFAULT, '', false, false, Categories::CONTENT);
     //        $this->properties[] = $this->contentNodeSet;
     //        $this->designNodeSet = new DefaultNodeSet('designNodeSet', 'design', 'design', Representations::_DEFAULT, '', false, false, Categories::DESIGN);
     //        $this->properties[] = $this->designNodeSet;
     $this->properties = array();
     if ($this->requestProperties) {
         header('Content-type: application/json');
         ob_start();
     }
 }