public function add($key, $value, $ns = 'conf')
 {
     $config = new Configuration();
     $config->setKey($ns . ':' . $key);
     $config->setValue($value);
     $config->save();
     $this->confTab[$ns][$key] = $value;
     unset($_SESSION['configuration']);
 }
Example #2
0
 /**
  * @static
  * @param $name
  * @param $value
  * @return void
  */
 public static function set($name, $value = null)
 {
     $configuration = ConfigurationPeer::retrieveByName($name);
     if (!$configuration) {
         $configuration = new Configuration();
         $configuration->setName($name);
     }
     $configuration->setValue($value);
     $configuration->save();
 }
Example #3
0
 /**
  * The function saves configuration values.
  * 
  * @access private
  */
 private function save()
 {
     if (isset($_POST['submit'])) {
         if (isset($_POST['Config']) && is_array($_POST['Config'])) {
             foreach ($_POST['Config'] as $key => $value) {
                 Configuration::setValue($key, $value);
             }
         }
         $this->halt();
     }
 }
Example #4
0
 private function saveForStorage()
 {
     $tmp = Configuration::getValue('project_' . $this->projectId);
     $tmp['b24connect'] = $this->resource;
     if (isset($tmp['info']['USERINFO'])) {
         $tmp['info']['USERINFO'] = array('access_token' => $this->resource['access_token'], 'refresh_token' => $this->resource['refresh_token'], 'expires_in' => $this->resource['expires_in'], 'domain' => $tmp['info']['USERINFO']['domain'], 'member_id' => $tmp['info']['USERINFO']['member_id']);
     } else {
         $tmp['info']['USERINFO'] = array('access_token' => $this->resource['access_token'], 'refresh_token' => $this->resource['refresh_token'], 'expires_in' => $this->resource['expires_in'], 'domain' => 'null', 'member_id' => 'null');
     }
     Configuration::setValue('project_' . $this->projectId, $tmp);
 }
Example #5
0
 /**
  * The departments edit handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function change()
 {
     if (isset($_POST['submit'])) {
         if (isset($_POST['Depart'])) {
             $arr = array();
             foreach ($_POST['Depart']['Name'] as $i => $value) {
                 if ($value) {
                     $arr['Name'][$i] = $value;
                     $arr['Email'][$i] = $_POST['Depart']['Email'][$i];
                 }
             }
             $_POST['Config']['contact/departs'] = $arr;
         }
         if (isset($_POST['Config']) && is_array($_POST['Config'])) {
             foreach ($_POST['Config'] as $key => $value) {
                 Configuration::setValue($key, $value);
             }
         }
         return $this->halt();
     }
     return $this->getView()->render();
 }
 /**
  * Test if a configuration init with a SimpleXMLElement
  * has been added correctly.
  *
  * @return void
  */
 public function testGetChildrenByInitWithSimpleXmlElement()
 {
     $this->configuration->init($this->getTestNode('test', 'testValue'));
     $toBeTested = new Configuration('testNode');
     $toBeTested->setAttr('test');
     $toBeTested->setValue('testValue');
     $this->assertEquals(array($toBeTested), $this->configuration->getChildren());
 }