Exemplo n.º 1
0
 public function onInit($param)
 {
     parent::onInit($param);
     /*		if($this->User->IsGuest)
     			$this->mnuPrincipal->Visible = false;
     		else*/
     $this->mnuPrincipal->Visible = true;
     /*
     		echo $this->User->Name;
     		echo "<br />";
     		echo $this->Application->id;
     */
     if ($this->Request["popup"] != null) {
         $this->mnuPrincipal->Visible = false;
         $this->pnlEncabezado->Visible = false;
         if ($this->Request["popup"] == "1") {
             $this->pnlCerrar->Visible = true;
         } else {
             $this->pnlCerrar->Visible = false;
         }
     } else {
         $this->pnlCerrar->Visible = false;
         $doc = new TXmlDocument();
         $doc->loadFromFile("protected/layouts/menu.xml");
         $x = $doc->getElements();
         $this->creaMenuXml($x, $this->mnuPrincipal);
     }
 }
 public function onPreInit($param)
 {
     parent::onPreInit($param);
     $docname = "tempXML";
     $ext = "xml";
     $header = "application/xml";
     $doc = new TXmlDocument('1.0', 'ISO-8859-1');
     $doc->TagName = 'menu';
     $doc->setAttribute('id', "0");
     $QVFile = new TXmlElement('item');
     $QVFile->setAttribute('id', "new_Element");
     $QVFile->setAttribute('img', "plus5.gif");
     $QVFile->setAttribute('text', "new element");
     $ActivityElements = ActivityTypeRecord::finder()->findAll();
     foreach ($ActivityElements as $Activitytype) {
         $ST = new TXmlElement('item');
         $ST->setAttribute('id', $Activitytype->idta_activity_type);
         $ST->setAttribute('img', 's' . $Activitytype->idta_activity_type . ".gif");
         $ST->setAttribute('text', utf8_encode($Activitytype->act_type_name));
         //hier muss die logik fuer die basiswerte aus den dimensionen hin...
         //hier hole ich mir die Dimensionsgruppen
         $QVFile->Elements[] = $ST;
     }
     $doc->Elements[] = $QVFile;
     //        $CMdelete=new TXmlElement('item');
     //        $CMdelete->setAttribute('id',"delete_Element");
     //        $CMdelete->setAttribute('img',"minus.gif");
     //        $CMdelete->setAttribute('text',"delete element");
     //
     //        $doc->Elements[]=$CMdelete;
     $this->getResponse()->appendHeader("Content-Type:" . $header);
     $this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $docName . '.' . $ext);
     $doc->saveToFile('php://output');
     exit;
 }
Exemplo n.º 3
0
 public function onLoad($param)
 {
     parent::onLoad($param);
     $this->dbConexion = Conexion::getConexion($this->Application, "db");
     Conexion::createConfiguracion();
     if (!$this->isPostBack) {
         if (array_search("nusr", $this->User->Roles)) {
             //Lee el archivo menu.xml para buscar los permisos de acceso a páginas que tenga activos para mostrar opciones
             $this->permisos = array();
             $this->asignados = array();
             $doc = new TXmlDocument();
             $doc->loadFromFile("protected/layouts/menu.xml");
             $x = $doc->getElements();
             $this->leeMenuXml($x);
             $this->cblPermisos->setDataSource($this->permisos);
             $this->cblPermisos->dataBind();
         }
         $this->Enlaza_Coord();
         $this->Enlaza_Usuario();
         if (!array_search("nusr", $this->User->Roles)) {
             $this->addlUsuarios->SelectedValue = $this->User->Name;
             $this->addlUsuarios_Callback(null, null);
             $this->addlUsuarios->Visible = false;
             $this->alblUsuarios->Visible = false;
             $this->alblPermisos->Visible = false;
             $this->atxtUsuario->Enabled = false;
         }
     }
 }
Exemplo n.º 4
0
 protected function getComponentShortCut()
 {
     $data = array();
     $app = $this->getApplication();
     $db = $app->getModule('horuxDb')->DbConnection;
     $db->Active = true;
     $cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='component' AND name!='tracking'");
     $data_ = $cmd->query();
     $data_ = $data_->readAll();
     $isComponentHasOne = false;
     foreach ($data_ as $d) {
         $doc = new TXmlDocument();
         $doc->loadFromFile('./protected/pages/components/' . $d['name'] . '/install.xml');
         $name = $doc->getElementByTagName('name');
         $installName = $doc->getElementByTagName('installName')->getValue();
         $cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='component' AND name='{$installName}'");
         $data1 = $cmd->query();
         $data1 = $data1->readAll();
         foreach ($data1 as $d1) {
             $cmd = $this->db->createCommand("SELECT * FROM hr_install AS i LEFT JOIN hr_component as c ON c.id_install=i.id WHERE i.type='component' AND c.parentmenu=0 AND i.id=" . $d1['id']);
             $data2 = $cmd->query();
             $data2 = $data2->read();
             $url = "./themes/letux/images/header/icon-48-link.png";
             if (!$isComponentHasOne) {
                 if ($this->isAccess($data2['page'])) {
                     $data[] = array('page' => $data2['page'], 'Name' => Prado::localize($name->getValue(), array(), $data2['name']), 'icon' => $url);
                 }
                 $isComponentHasOne = true;
             } else {
                 if ($this->isAccess($data2['page'])) {
                     $data[] = array('page' => $data2['page'], 'Name' => Prado::localize($name->getValue(), array(), $data2['name']), 'icon' => $url);
                 }
             }
             $cmd = $this->db->createCommand("SELECT * FROM hr_install AS i LEFT JOIN hr_component as c ON c.id_install=i.id WHERE i.type='component' AND c.parentmenu=" . $data2['id'] . " AND c.parentmenu>0 AND i.id=" . $d1['id']);
             $data2 = $cmd->query();
             $data2 = $data2->readAll();
             foreach ($data2 as $d2) {
                 if ($this->isAccess($d2['page'])) {
                     $pagePath = str_replace(".", "/", $d2['page']);
                     if (file_exists('./protected/pages/' . $pagePath . '.page')) {
                         $content = file_get_contents('./protected/pages/' . $pagePath . '.page');
                         if (preg_match("/IconAsset=\"<%~(.*)%>\"/", $content, $matches)) {
                             if (($assetPos = strrpos($matches[1], "assets/")) !== false) {
                                 $icon = substr($matches[1], $assetPos + 7);
                                 $icon = trim($icon);
                                 if ($icon) {
                                     $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getApplication()->getBasePath() . '/pages/components/' . $d2['name'] . '/assets/' . $icon);
                                 }
                             }
                         }
                     }
                     $data[] = array('page' => $d2['page'], 'Name' => Prado::localize($d2['menuname'], array(), $d2['name']), 'icon' => $url);
                 }
             }
         }
     }
     return $data;
 }
 public function onPreInit($param)
 {
     parent::onPreInit($param);
     $docname = "tempXML";
     $ext = "xml";
     $header = "application/xml";
     $doc = new TXmlDocument('1.0', 'ISO-8859-1');
     $doc->TagName = 'menu';
     $doc->setAttribute('id', "0");
     $QVFile = new TXmlElement('item');
     $QVFile->setAttribute('id', "new_Element");
     $QVFile->setAttribute('img', "plus5.gif");
     $QVFile->setAttribute('text', "new element");
     $StrukturElements = StrukturTypeRecord::finder()->findAll();
     foreach ($StrukturElements as $Strukturtype) {
         $ST = new TXmlElement('item');
         $ST->setAttribute('id', 'idta_struktur_type_' . $Strukturtype->idta_struktur_type);
         $ST->setAttribute('img', 's' . $Strukturtype->idta_struktur_type . ".gif");
         $ST->setAttribute('text', $Strukturtype->struktur_type_name);
         //hier muss die logik fuer die basiswerte aus den dimensionen hin...
         //hier hole ich mir die Dimensionsgruppen
         $fstsql = "SELECT stammdaten_group_name, (ta_stammdaten_group.idta_stammdaten_group) AS parent_idta_stammdaten_group FROM ta_stammdaten_group INNER JOIN tm_stammdaten ON tm_stammdaten.idta_stammdaten_group = ta_stammdaten_group.idta_stammdaten_group WHERE idta_struktur_type = " . $Strukturtype->idta_struktur_type . " GROUP BY stammdaten_group_name, parent_idta_stammdaten_group";
         $BaseGroupElements = StammdatenGroupRecord::finder()->findAllBySQL($fstsql);
         foreach ($BaseGroupElements as $BaseGroupElement) {
             $BGE = new TXmlElement('item');
             $BGE->setAttribute('id', 'idta_stammdaten_group_' . $BaseGroupElement->parent_idta_stammdaten_group);
             $BGE->setAttribute('img', 's' . $Strukturtype->idta_struktur_type . ".gif");
             $BGE->setAttribute('text', $BaseGroupElement->stammdaten_group_name);
             //zuerst hole ich alle Basiselement, die den aktuellen Strukturtypen haben
             $sql = "SELECT idtm_stammdaten,stammdaten_name, tm_stammdaten.idta_stammdaten_group FROM tm_stammdaten INNER JOIN ta_stammdaten_group ON tm_stammdaten.idta_stammdaten_group = ta_stammdaten_group.idta_stammdaten_group WHERE idta_struktur_type = " . $Strukturtype->idta_struktur_type . " AND ta_stammdaten_group.idta_stammdaten_group = " . $BaseGroupElement->parent_idta_stammdaten_group . " ORDER BY idta_stammdaten_group";
             $BaseElements = StammdatenRecord::finder()->findAllBySQL($sql);
             foreach ($BaseElements as $BaseElement) {
                 $BE = new TXmlElement('item');
                 $BE->setAttribute('id', 'idtm_stammdaten_' . $BaseElement->idtm_stammdaten);
                 $BE->setAttribute('img', 'str' . $Strukturtype->idta_struktur_type . ".gif");
                 $BE->setAttribute('text', $BaseElement->stammdaten_name);
                 $BGE->Elements[] = $BE;
             }
             $ST->Elements[] = $BGE;
         }
         $QVFile->Elements[] = $ST;
     }
     $doc->Elements[] = $QVFile;
     $CMdelete = new TXmlElement('item');
     $CMdelete->setAttribute('id', "delete_Element");
     $CMdelete->setAttribute('img', "minus.gif");
     $CMdelete->setAttribute('text', "delete element");
     $doc->Elements[] = $CMdelete;
     $docName = "temp";
     $this->getResponse()->appendHeader("Content-Type:" . $header);
     $this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $docName . '.' . $ext);
     $doc->saveToFile('php://output');
     exit;
 }
Exemplo n.º 6
0
 public function setUp()
 {
     if (self::$app === null) {
         self::$app = new TApplication(dirname(__FILE__) . '/app');
         prado::setPathofAlias('App', dirname(__FILE__));
     }
     if (self::$mgr === null) {
         $config = new TXmlDocument('1.0', 'utf8');
         $config->loadFromString('<users><user name="Joe" password="******"/><user name="John" password="******" /><role name="Administrator" users="John" /><role name="Writer" users="Joe,John" /></users>');
         self::$mgr = new TUserManager();
         self::$mgr->init($config);
     }
 }
Exemplo n.º 7
0
 /**
  * Initializes this module.
  * This method is required by the IModule interface.
  * @param TXmlElement configuration for this module, can be null
  * @throws TConfigurationException if {@link getConfigFile ConfigFile} is invalid.
  */
 public function init($config)
 {
     if ($this->_configFile !== null) {
         if (is_file($this->_configFile)) {
             $dom = new TXmlDocument();
             $dom->loadFromFile($this->_configFile);
             $this->loadConfig($dom);
         } else {
             throw new TConfigurationException('xmlrpcservice_configfile_invalid', $this->_configFile);
         }
     }
     $this->loadConfig($config);
     $this->resolveRequest();
 }
Exemplo n.º 8
0
 /**
  * Initializes this module.
  * This method is required by the IModule interface.
  * @param TXmlElement configuration for this module, can be null
  * @throws TConfigurationException if {@link getConfigFile ConfigFile} is invalid.
  */
 public function init($config)
 {
     if ($this->_configFile !== null) {
         if (is_file($this->_configFile)) {
             $dom = new TXmlDocument();
             $dom->loadFromFile($this->_configFile);
             $this->loadConfig($dom);
         } else {
             throw new TConfigurationException('logrouter_configfile_invalid', $this->_configFile);
         }
     }
     $this->loadConfig($config);
     $this->getApplication()->attachEventHandler('OnEndRequest', array($this, 'collectLogs'));
 }
Exemplo n.º 9
0
 public function setUp()
 {
     ini_set('session.use_cookies', 0);
     ini_set('session.cache_limiter', 'none');
     if (self::$app === null) {
         self::$app = new TApplication(dirname(__FILE__) . '/app');
     }
     // Make a fake user manager module
     if (self::$usrMgr === null) {
         self::$usrMgr = new TUserManager();
         $config = new TXmlDocument('1.0', 'utf8');
         $config->loadFromString('<users><user name="Joe" password="******"/><user name="John" password="******" /><role name="Administrator" users="John" /><role name="Writer" users="Joe,John" /></users>');
         self::$usrMgr->init($config);
         self::$app->setModule('users', self::$usrMgr);
     }
 }
Exemplo n.º 10
0
 public function testSaveToFile()
 {
     $file = dirname(__FILE__) . '/data/tmp.xml';
     if (!is_writable(dirname($file))) {
         self::markTestSkipped(dirname($file) . ' must be writable for this test');
     }
     $xmldoc = new TXmlDocument('1.0', 'utf-8');
     $xmldoc->setTagName('root');
     $node = new TXmlElement('node');
     $node->setAttribute('param', 'attribute1');
     $xmldoc->getElements()->add($node);
     $xmldoc->saveToFile($file);
     self::assertTrue(is_file($file));
     if (is_file($file)) {
         unlink($file);
     }
 }
Exemplo n.º 11
0
 /**
  * Initializes the module by loading parameters.
  * @param TXmlElement content enclosed within the module tag
  */
 public function init($config)
 {
     $this->loadParameters($config);
     if ($this->_paramFile !== null) {
         if (($cache = $this->getApplication()->getCache()) !== null) {
             $cacheKey = 'TParameterModule:' . $this->_paramFile;
             if (($dom = $cache->get($cacheKey)) === false) {
                 $dom = new TXmlDocument();
                 $dom->loadFromFile($this->_paramFile);
                 $cache->set($cacheKey, $dom, 0, new TFileCacheDependency($this->_paramFile));
             }
         } else {
             $dom = new TXmlDocument();
             $dom->loadFromFile($this->_paramFile);
         }
         $this->loadParameters($dom);
     }
     $this->_initialized = true;
 }
Exemplo n.º 12
0
 public function saveButtonClicked($sender, $param)
 {
     $dom = new TXmlDocument();
     $dom->Encoding = 'utf-8';
     $dom->TagName = 'parameters';
     $elements = $dom->Elements;
     $elements[] = $this->createParameter('SiteTitle', $this->SiteTitle->Text);
     $elements[] = $this->createParameter('SiteSubtitle', $this->SiteSubtitle->Text);
     $elements[] = $this->createParameter('SiteOwner', $this->SiteOwner->Text);
     $elements[] = $this->createParameter('AdminEmail', $this->AdminEmail->Text);
     $elements[] = $this->createParameter('MultipleUser', $this->MultipleUser->Checked);
     $elements[] = $this->createParameter('AccountApproval', $this->AccountApproval->Checked);
     $elements[] = $this->createParameter('PostPerPage', $this->PostPerPage->Text);
     $elements[] = $this->createParameter('RecentComments', $this->RecentComments->Text);
     $elements[] = $this->createParameter('PostApproval', $this->PostApproval->Checked);
     $themeName = $this->ThemeName->SelectedItem->Text;
     $elements[] = $this->createParameter('ThemeName', $themeName);
     $dom->saveToFile(Prado::getPathOfNamespace(self::CONFIG_FILE, '.xml'));
     if ($themeName !== $this->Theme->Name) {
         $this->Response->reload();
     }
 }
Exemplo n.º 13
0
 /**
  * Initializes the module by loading parameters.
  * @param mixed content enclosed within the module tag
  */
 public function init($config)
 {
     $this->loadParameters($config);
     if ($this->_paramFile !== null) {
         $configFile = null;
         if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_XML && ($cache = $this->getApplication()->getCache()) !== null) {
             $cacheKey = 'TParameterModule:' . $this->_paramFile;
             if (($configFile = $cache->get($cacheKey)) === false) {
                 $cacheFile = new TXmlDocument();
                 $cacheFile->loadFromFile($this->_paramFile);
                 $cache->set($cacheKey, $cacheFile, 0, new TFileCacheDependency($this->_paramFile));
             }
         } else {
             if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
                 $configFile = (include $this->_paramFile);
             } else {
                 $configFile = new TXmlDocument();
                 $configFile->loadFromFile($this->_paramFile);
             }
         }
         $this->loadParameters($configFile);
     }
     $this->_initialized = true;
 }
Exemplo n.º 14
0
 public function selectionChangedModule($sender, $param)
 {
     $value = $sender->getSelectedValue();
     $d = array();
     $d[] = array("Text" => Prado::localize("-- Select a Module--"), "Value" => "0");
     if ($value == "." || $value == "0") {
         $this->extension->DataSource = $d;
         $this->extension->dataBind();
         $this->displayLanguage();
         return;
     }
     $list = array();
     if ($value == "themes") {
         $list = scandir("." . DIRECTORY_SEPARATOR . "themes");
     } else {
         $value = str_replace(".", DIRECTORY_SEPARATOR, $value);
         $list = scandir("." . DIRECTORY_SEPARATOR . "protected" . DIRECTORY_SEPARATOR . "pages" . DIRECTORY_SEPARATOR . $value);
     }
     $i = 1;
     foreach ($list as $l) {
         if ($l != "." && $l != ".." && $l != ".svn") {
             $doc = new TXmlDocument();
             if ($value == "themes") {
                 $doc->loadFromFile('.' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $l . DIRECTORY_SEPARATOR . 'install.xml');
             } else {
                 $doc->loadFromFile('.' . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . $value . DIRECTORY_SEPARATOR . $l . DIRECTORY_SEPARATOR . 'install.xml');
             }
             $name = $doc->getElementByTagName('name');
             $d[$i]['Value'] = $l;
             $d[$i++]['Text'] = $name->getValue();
         }
     }
     $this->extension->DataSource = $d;
     $this->extension->dataBind();
     $this->displayLanguage();
 }
Exemplo n.º 15
0
 public function getData()
 {
     $cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='template'");
     $data = $cmd->query();
     $data = $data->readAll();
     $template = array();
     foreach ($data as $d) {
         $doc = new TXmlDocument();
         $doc->loadFromFile('.' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $d['name'] . DIRECTORY_SEPARATOR . 'install.xml');
         $version = $doc->getElementByTagName('version');
         $date = $doc->getElementByTagName('creationDate');
         $description = $doc->getElementByTagName('description');
         $author = $doc->getElementByTagName('author');
         $license = $doc->getElementByTagName('license');
         $name = $doc->getElementByTagName('name');
         $template[] = array('id' => $d['id'], 'name' => $name->getValue(), 'default' => $d['default'], 'version' => $version->getValue(), 'date' => $date->getValue(), 'description' => $description->getValue(), 'author' => $author->getValue(), 'license' => $license->getValue());
     }
     return $template;
 }
Exemplo n.º 16
0
 /**
  * Loads a specific config file.
  * @param string config file name
  * @param string the page path that the config file is associated with. The page path doesn't include the page name.
  */
 public function loadFromFile($fname, $configPagePath)
 {
     Prado::trace("Loading page configuration file {$fname}", 'System.Web.Services.TPageService');
     if (empty($fname) || !is_file($fname)) {
         return;
     }
     $dom = new TXmlDocument();
     if ($dom->loadFromFile($fname)) {
         $this->loadFromXml($dom, dirname($fname), $configPagePath);
     } else {
         throw new TConfigurationException('pageserviceconf_file_invalid', $fname);
     }
 }
Exemplo n.º 17
0
 protected function installComponent($compName)
 {
     $doc = new TXmlDocument();
     $doc->loadFromFile('.' . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . '' . $compName . DIRECTORY_SEPARATOR . 'install.xml');
     $installName = $doc->getElementByTagName('installName');
     $sqlinstall = $doc->getElementByTagName('sqlinstall');
     if ($sqlinstall) {
         $this->sqlInstall('.' . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $compName . DIRECTORY_SEPARATOR . $sqlinstall->getValue());
     }
     $cmd = $this->db->createCommand("INSERT INTO hr_install (`name`,`type`,`system`, `default`, `param`) VALUES (:name, 'component',0,0,'')");
     $cmd->bindValue(":name", $installName->getValue(), PDO::PARAM_STR);
     $cmd->execute();
     $lastId = $this->db->getLastInsertId();
     $mainmenu = $doc->getElementByTagName('mainmenu');
     $mainmenu = $mainmenu->getElements();
     foreach ($mainmenu as $menu) {
         $iconmenu = $menu->getAttribute('iconmenu');
         $url = $menu->getAttribute('url');
         $menuname = $menu->getAttribute('name');
         $parentmenu = 0;
         $cmd = $this->db->createCommand("INSERT INTO hr_component (`id_install`,`parentmenu`,`menuname`, `page`, `iconmenu`) VALUES (:lastId, :parentmenu,:menuname,:url,:iconmenu)");
         $cmd->bindValue(":lastId", $lastId, PDO::PARAM_INT);
         $cmd->bindValue(":iconmenu", $iconmenu, PDO::PARAM_STR);
         $cmd->bindValue(":url", $url, PDO::PARAM_STR);
         $cmd->bindValue(":menuname", $menuname, PDO::PARAM_STR);
         $cmd->bindValue(":parentmenu", $parentmenu, PDO::PARAM_INT);
         $cmd->execute();
         if ($menu->getHasElement()) {
             $submenu = $menu->getElementByTagName('submenus');
             $submenu = $submenu->getElements();
             $lastMenuId = $this->db->getLastInsertId();
             foreach ($submenu as $smenu) {
                 $iconmenu = $smenu->getAttribute('iconmenu');
                 $url = $smenu->getAttribute('url');
                 $menuname = $smenu->getAttribute('name');
                 $cmd = $this->db->createCommand("INSERT INTO hr_component (`id_install`,`parentmenu`,`menuname`, `page`, `iconmenu`) VALUES (:lastId, :parentmenu,:menuname,:url,:iconmenu)");
                 $cmd->bindValue(":lastId", $lastId, PDO::PARAM_INT);
                 $cmd->bindValue(":iconmenu", $iconmenu, PDO::PARAM_STR);
                 $cmd->bindValue(":url", $url, PDO::PARAM_STR);
                 $cmd->bindValue(":menuname", $menuname, PDO::PARAM_STR);
                 $cmd->bindValue(":parentmenu", $lastMenuId, PDO::PARAM_INT);
                 $cmd->execute();
             }
         }
     }
     $this->moveLanguageDirectory('.' . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . '' . $compName . DIRECTORY_SEPARATOR, $installName->getValue());
     return true;
 }
Exemplo n.º 18
0
 /**
  * Initializes the module.
  * This method is required by IModule and is invoked by application.
  * It loads user/role information from the module configuration.
  * @param mixed module configuration
  */
 public function init($config)
 {
     $this->loadUserData($config);
     if ($this->_userFile !== null) {
         if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
             $userFile = (include $this->_userFile);
             $this->loadUserDataFromPhp($userFile);
         } else {
             $dom = new TXmlDocument();
             $dom->loadFromFile($this->_userFile);
             $this->loadUserDataFromXml($dom);
         }
     }
     $this->_initialized = true;
 }
Exemplo n.º 19
0
 public function loadFromFile($fname)
 {
     $dom = new TXmlDocument();
     $dom->loadFromFile($fname);
     $this->loadFromXml($dom, dirname($fname));
 }
Exemplo n.º 20
0
 public function testRequestWithUrlMapping()
 {
     Prado::Using('System.Web.TUrlMapping');
     $confstr = '<config><url ServiceId="testService" ServiceParameter="testServiceParam" pattern="test/{param}/?" parameters.param="\\w+"/></config>';
     $config = new TXmlDocument('1.0', 'utf8');
     $config->loadFromString($confstr);
     $module = new TUrlMapping();
     self::$app->setModule('friendly-url', $module);
     if (isset($_GET['page'])) {
         unset($_GET['page']);
     }
     // Remove service from a previous test !
     $_SERVER['REQUEST_URI'] = '/index.php/test/value2';
     $_SERVER['SCRIPT_NAME'] = '/index.php';
     $_SERVER['PHP_SELF'] = '/index.php/test/value2';
     $_SERVER['QUERY_STRING'] = '';
     $_SERVER['PATH_INFO'] = '/test/value2';
     $request = new THttpRequest();
     $request->setUrlManager('friendly-url');
     $request->setUrlFormat(THttpRequestUrlFormat::Path);
     $request->init(null);
     $module->init($config);
     self::assertEquals('testService', $request->resolveRequest(array('page', 'testService')));
 }
Exemplo n.º 21
0
 /**
  * Initialize the module from configuration file.
  * @throws TConfigurationException if {@link getConfigFile ConfigFile} is invalid.
  */
 protected function loadConfigFile()
 {
     if (is_file($this->_configFile)) {
         $dom = new TXmlDocument();
         $dom->loadFromFile($this->_configFile);
         $this->loadUrlMappings($dom);
     } else {
         throw new TConfigurationException('urlmapping_configfile_inexistent', $this->_configFile);
     }
 }
Exemplo n.º 22
0
 protected function saveData()
 {
     $key = $this->Request->getKeys();
     $res = array();
     for ($i = 0; $i < count($key); $i++) {
         if (strpos($key[$i], "hidden_") !== FALSE) {
             $res[$this->Request[$key[$i]]] = $this->Request[$key[$i + 1]];
         }
     }
     $id = $this->Request["id"];
     $cmd = $this->db->createCommand("SELECT i.name FROM hr_install AS i LEFT JOIN hr_component AS c ON c.id_install=i.id WHERE i.id=:id AND c.parentmenu=0");
     $cmd->bindValue(":id", $id, PDO::PARAM_INT);
     $cmd = $cmd->query();
     $data = $cmd->read();
     $this->cname->Text = $data["name"];
     $xml = "." . DIRECTORY_SEPARATOR . "protected" . DIRECTORY_SEPARATOR . "pages" . DIRECTORY_SEPARATOR . "components" . DIRECTORY_SEPARATOR . $data["name"] . DIRECTORY_SEPARATOR . "config.xml";
     if (file_exists($xml)) {
         $doc = new TXmlDocument();
         $doc->loadFromFile($xml);
         $parameters = $doc->getElementByTagName('parameters');
         $parameters = $parameters->getElements();
         foreach ($parameters as $parameter) {
             $k = $parameter->getAttribute('id');
             $parameter->setAttribute('value', $res[$k]);
         }
         $doc->saveToFile($xml);
     }
     return true;
 }
Exemplo n.º 23
0
 public function loadFromFile($fname)
 {
     if (Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
         $fcontent = (include $fname);
         $this->loadFromPhp($fcontent, dirname($fname));
     } else {
         $dom = new TXmlDocument();
         $dom->loadFromFile($fname);
         $this->loadFromXml($dom, dirname($fname));
     }
 }
Exemplo n.º 24
0
 /**
  * Loads a specific config file.
  * @param string config file name
  * @param string the page path that the config file is associated with. The page path doesn't include the page name.
  */
 public function loadFromFile($fname, $configPagePath)
 {
     Prado::trace("Loading page configuration file {$fname}", 'System.Web.Services.TPageService');
     if (empty($fname) || !is_file($fname)) {
         return;
     }
     if (Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
         $fcontent = (include $fname);
         $this->loadFromPhp($fcontent, dirname($fname), $configPagePath);
     } else {
         $dom = new TXmlDocument();
         if ($dom->loadFromFile($fname)) {
             $this->loadFromXml($dom, dirname($fname), $configPagePath);
         } else {
             throw new TConfigurationException('pageserviceconf_file_invalid', $fname);
         }
     }
 }
Exemplo n.º 25
0
 protected function insertNewPermissions($lastId)
 {
     $data = $this->Session['dataPage'];
     foreach ($data as $v) {
         switch ($v['id']) {
             case "controlPanel":
                 $v['access'] ? $this->insertNewPermission($lastId, 'controlPanel.ControlPanel') : '';
                 break;
             case "superUser":
                 $v['access'] ? $this->insertNewPermission($lastId, 'superuser.userList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'superuser.userAdd') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'superuser.userMod') : '';
                 break;
             case "superUserGroup":
                 $v['access'] ? $this->insertNewPermission($lastId, 'superuser.userGroupList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'superuser.userGroupAdd') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'superuser.userGroupMod') : '';
                 break;
             case "configuration":
                 $v['access'] ? $this->insertNewPermission($lastId, 'configuration.config', $v['shortcut']) : '';
                 break;
             case "site":
                 $v['access'] ? $this->insertNewPermission($lastId, 'site.Site', $v['shortcut']) : '';
                 break;
             case "department":
                 $v['access'] ? $this->insertNewPermission($lastId, 'site.department', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'site.add', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'site.mod', $v['shortcut']) : '';
                 break;
             case "openTime":
                 $v['access'] ? $this->insertNewPermission($lastId, 'openTime.openTimeList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'openTime.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'openTime.mod') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'openTime.attribute') : '';
                 break;
             case "horuxController":
                 $v['access'] ? $this->insertNewPermission($lastId, 'horuxController.horuxController', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'horuxController.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'horuxController.mod') : '';
                 break;
             case "hardware":
                 $v['access'] ? $this->insertNewPermission($lastId, 'hardware.HardwareList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'hardware.HardwareAddList') : '';
                 $path = './protected/pages/hardware/device/';
                 $files = scandir($path);
                 foreach ($files as $f) {
                     if ($f != '..' && $f != '.' && $f != '.svn' && is_dir($path . $f)) {
                         $doc = new TXmlDocument();
                         $doc->loadFromFile($path . $f . '/install.xml');
                         $permissions = $doc->getElementByTagName('permissions');
                         $permissions = $permissions->getElements();
                         foreach ($permissions as $perm) {
                             $v['access'] ? $this->insertNewPermission($lastId, $perm->getValue()) : '';
                         }
                     }
                 }
                 break;
             case "alarms":
                 $v['access'] ? $this->insertNewPermission($lastId, 'system.Alarms', $v['shortcut']) : '';
                 break;
             case "notification":
                 $v['access'] ? $this->insertNewPermission($lastId, 'system.Notification', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'system.NotificationAdd') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'system.NotificationMod') : '';
                 break;
             case "service":
                 $v['access'] ? $this->insertNewPermission($lastId, 'system.Service', $v['shortcut']) : '';
                 break;
             case "status":
                 $v['access'] ? $this->insertNewPermission($lastId, 'system.Status', $v['shortcut']) : '';
                 break;
             case "user":
                 $v['access'] ? $this->insertNewPermission($lastId, 'user.UserList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'user.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'user.mod') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'user.attribution') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'user.groups') : '';
                 break;
             case "userGroup":
                 $v['access'] ? $this->insertNewPermission($lastId, 'userGroup.UserGroupList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'userGroup.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'userGroup.mod') : '';
                 break;
             case "userWizard":
                 $v['access'] ? $this->insertNewPermission($lastId, 'user.UserWizzard', $v['shortcut']) : '';
                 break;
             case "key":
                 $v['access'] ? $this->insertNewPermission($lastId, 'key.KeyList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'key.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'key.mod') : '';
                 break;
             case "accessLevel":
                 $v['access'] ? $this->insertNewPermission($lastId, 'accessLevel.accessLevelList', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'accessLevel.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'accessLevel.mod') : '';
                 break;
             case "nonWorkingDay":
                 $v['access'] ? $this->insertNewPermission($lastId, 'nonWorkingDay.nonWorkingDay', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'nonWorkingDay.add') : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'nonWorkingDay.mod') : '';
                 break;
             case "install_uninstall":
                 $v['access'] ? $this->insertNewPermission($lastId, 'installation.extensions', $v['shortcut']) : '';
                 break;
             case "devices":
                 $v['access'] ? $this->insertNewPermission($lastId, 'installation.devices', $v['shortcut']) : '';
                 break;
             case "components":
                 $v['access'] ? $this->insertNewPermission($lastId, 'installation.components', $v['shortcut']) : '';
                 $v['access'] ? $this->insertNewPermission($lastId, 'installation.componentconfig') : '';
                 break;
             case "template":
                 $v['access'] ? $this->insertNewPermission($lastId, 'installation.template', $v['shortcut']) : '';
                 break;
             case "language":
                 $v['access'] ? $this->insertNewPermission($lastId, 'installation.language', $v['shortcut']) : '';
                 break;
             case "recycling":
                 $v['access'] ? $this->insertNewPermission($lastId, 'key.recycling', $v['shortcut']) : '';
                 break;
             case "globalCheckin":
                 $v['access'] ? $this->insertNewPermission($lastId, 'tool.GlobalCheckin', $v['shortcut']) : '';
                 break;
             case "guilog":
                 $v['access'] ? $this->insertNewPermission($lastId, 'tool.GuiLog', $v['shortcut']) : '';
                 break;
             case "update":
                 $v['access'] ? $this->insertNewPermission($lastId, 'update.Update', $v['shortcut']) : '';
                 break;
             case "systemInfo":
                 $v['access'] ? $this->insertNewPermission($lastId, 'help.SystemInfo', $v['shortcut']) : '';
                 break;
             case "about":
                 $v['access'] ? $this->insertNewPermission($lastId, 'help.About', $v['shortcut']) : '';
                 break;
             default:
                 /*add child permission*/
                 $path = './protected/pages/components/' . $v['composantname'];
                 $files = scandir($path);
                 $doc = new TXmlDocument();
                 $doc->loadFromFile($path . '/install.xml');
                 $permissions = $doc->getElementByTagName('permissions');
                 $permissions = $permissions->getElements();
                 $id = 0;
                 $addParent = null;
                 //! find the parent id of $v['id']
                 foreach ($permissions as $perm) {
                     if ($perm->getValue() == $v['id']) {
                         $id = $perm->getAttribute('id');
                         $addParent = $perm->getAttribute('add');
                     }
                 }
                 //add each permission where the parentid equal the id
                 foreach ($permissions as $perm) {
                     if ($id == $perm->getAttribute('parent')) {
                         $v['access'] ? $this->insertNewPermission($lastId, $perm->getValue()) : '';
                     }
                 }
                 if ($addParent === null || $addParent == "true") {
                     $v['access'] ? $this->insertNewPermission($lastId, $v['id'], $v['shortcut']) : '';
                 }
                 break;
         }
     }
 }
Exemplo n.º 26
0
 protected function onPrint()
 {
     parent::onPrint();
     $param = $this->Application->getParameters();
     $groupId = $this->Application->getUser()->getGroupID();
     $nCell = 0;
     $accessRight = array();
     $cellHeaderWidth = 6;
     $cellHeaderHeight = 40;
     $this->pdf->AddPage('L');
     $this->pdf->SetFont('Arial', '', 11);
     $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the super users groups')), 0, 0, 'L');
     $this->pdf->Ln(10);
     $this->pdf->setDefaultFont();
     //! put a marge
     $this->pdf->Cell(30);
     $this->pdf->SetFillColor(124, 124, 124);
     $this->pdf->SetTextColor(255);
     $this->pdf->SetDrawColor(255);
     $this->pdf->SetLineWidth(0.3);
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Control Panel')), 1, 0, 'D', true);
     $accessRight[] = "controlPanel.ControlPanel";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Super User')), 1, 0, 'D', true);
     $accessRight[] = "superuser.userList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Super User Group')), 1, 0, 'D', true);
     $accessRight[] = "superuser.userGroupList";
     if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') {
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Configuration')), 1, 0, 'D', true);
         $accessRight[] = "configuration.config";
     } else {
         $nCell--;
     }
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Site')), 1, 0, 'D', true);
     $accessRight[] = "site.Site";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Hardware')), 1, 0, 'D', true);
     $accessRight[] = "hardware.HardwareList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Opent time')), 1, 0, 'D', true);
     $accessRight[] = "openTime.openTimeList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Alarms')), 1, 0, 'D', true);
     $accessRight[] = "system.Alarms";
     if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') {
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Horux Service')), 1, 0, 'D', true);
         $accessRight[] = "system.Service";
     } else {
         $nCell--;
     }
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Horux Status')), 1, 0, 'D', true);
     $accessRight[] = "system.Status";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('User')), 1, 0, 'D', true);
     $accessRight[] = "user.UserList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('User Group')), 1, 0, 'D', true);
     $accessRight[] = "userGroup.UserGroupList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('User Wizard')), 1, 0, 'D', true);
     $accessRight[] = "user.UserWizzard";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Key')), 1, 0, 'D', true);
     $accessRight[] = "key.KeyList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Access Level')), 1, 0, 'D', true);
     $accessRight[] = "accessLevel.accessLevelList";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Non Working Day')), 1, 0, 'D', true);
     $accessRight[] = "nonWorkingDay.nonWorkingDay";
     $cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='component'");
     $data = $cmd->query();
     $data = $data->readAll();
     $this->pdf->SetFillColor(176, 176, 176);
     foreach ($data as $d) {
         $nCell++;
         $doc = new TXmlDocument();
         $doc->loadFromFile('./protected/pages/components/' . $d['name'] . '/install.xml');
         $name = $doc->getElementByTagName('name');
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize($name->getValue())), 1, 0, 'D', true);
         $accessRight[] = "components." . $d['name'];
     }
     $this->pdf->SetFillColor(124, 124, 124);
     if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') {
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Install/Uninstall')), 1, 0, 'D', true);
         $accessRight[] = "installation.extensions";
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Devices Manager')), 1, 0, 'D', true);
         $accessRight[] = "installation.devices";
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Component Manager')), 1, 0, 'D', true);
         $accessRight[] = "installation.components";
         $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Template Manager')), 1, 0, 'D', true);
         $accessRight[] = "installation.template";
     } else {
         $nCell -= 4;
     }
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Language Manager')), 1, 0, 'D', true);
     $accessRight[] = "installation.language";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Global Checkin')), 1, 0, 'D', true);
     $accessRight[] = "tool.GlobalCheckin";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Horux Gui log')), 1, 0, 'D', true);
     $accessRight[] = "tool.GuiLog";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('System Info')), 1, 0, 'D', true);
     $accessRight[] = "help.SystemInfo";
     $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('About')), 1, 1, 'D', true);
     $accessRight[] = "help.About";
     $nCell += 25;
     $groups = $this->getData();
     foreach ($groups as $g) {
         if ($g['superAdmin'] == 1) {
             $this->pdf->SetFillColor(255, 76, 76);
         } else {
             $this->pdf->SetFillColor(124, 124, 124);
         }
         $this->pdf->Cell(30, $cellHeaderWidth, utf8_decode($g['name']), 1, 0, 'L', true);
         for ($i = 0; $i < $nCell; $i++) {
             $cmd = $this->db->createCommand("SELECT * FROM hr_gui_permissions  WHERE page LIKE '" . $accessRight[$i] . "%' AND value=" . $g['id']);
             $data = $cmd->query();
             $data = $data->readAll();
             if ($data || $accessRight[$i] == "controlPanel.ControlPanel" || $accessRight[$i] == "help.About") {
                 $this->pdf->Image("./fpdf/ok.png", $this->pdf->GetX() + $i * 6 + 1.5, $this->pdf->GetY() + 1.5, 3, 3);
             } else {
                 $this->pdf->Image("./fpdf/ko.png", $this->pdf->GetX() + $i * 6 + 1.5, $this->pdf->GetY() + 1.5, 3, 3);
             }
         }
         $this->pdf->Ln(6);
     }
     $this->pdf->Ln(10);
     $this->pdf->SetTextColor(0);
     $this->pdf->SetDrawColor(0);
     $groups = $this->getData();
     foreach ($groups as $g) {
         $this->pdf->Cell(80, $cellHeaderWidth, utf8_decode(Prado::Localize('Super users in "{g}" group', array("g" => $g['name']))), 'B', 1);
         $cmd = $this->db->createCommand("SELECT su.name AS username, u.name, u.firstname FROM hr_superusers AS su LEFT JOIN hr_user AS u ON u.id=su.user_id WHERE su.group_id=" . $g['id']);
         $data = $cmd->query();
         $users = $data->readAll();
         $userList = array();
         foreach ($users as $user) {
             $u = $user['username'];
             if (strlen($user['name']) > 0 || strlen($user['firstname']) > 0) {
                 $u .= " (" . $user['name'] . " " . $user['firstname'] . ")";
             }
             $userList[] = utf8_decode($u);
         }
         $userList = join(', ', $userList);
         $this->pdf->MultiCell(0, 6, $userList, 0, 1);
     }
     $this->pdf->render();
 }
Exemplo n.º 27
0
 public function buildParameterXML($idta_berichte = 0)
 {
     $doc = new TXmlDocument('1.0', 'UTF-8');
     $SingleReport = BerichteRecord::finder()->findByidta_berichte($idta_berichte);
     $doc->TagName = 'Reports';
     $doc->setAttribute('xmlns:d4p1', "http://schemas.datacontract.org/2004/07/QVMailerExecutionService");
     $doc->setAttribute('xmlns:i', "http://www.w3.org/2001/XMLSchema-instance");
     $QVFile = new TXmlElement('QlikViewFile');
     $QVFile->Value = mb_convert_encoding($SingleReport->ber_local_path, $target_encoding);
     $doc->Elements[] = $QVFile;
     $BerName = new TXmlElement('ReportName');
     $BerName->Value = mb_convert_encoding($SingleReport->ber_name, $target_encoding);
     $doc->Elements[] = $BerName;
     $BerID = new TXmlElement('ReportId');
     $BerID->Value = mb_convert_encoding($SingleReport->ber_id, $target_encoding);
     $doc->Elements[] = $BerID;
     $BerMailSub = new TXmlElement('MailSubject');
     $BerMailSub->Value = mb_convert_encoding($SingleReport->ber_mail_subject, $target_encoding);
     $doc->Elements[] = $BerMailSub;
     $BerMailBody = new TXmlElement('MailBody');
     $BerMailBody->Value = mb_convert_encoding(htmlspecialchars_decode($SingleReport->ber_mail_body), $target_encoding);
     $doc->Elements[] = $BerMailBody;
     $Recipients = new TXmlElement('Recipients');
     $RCPS = BerichteOrganisationRecord::finder()->findAllByidta_berichte($SingleReport->idta_berichte);
     //schleife für alle empfänger
     foreach ($RCPS as $RCP) {
         $USER = OrganisationRecord::finder()->findByPK($RCP->idtm_organisation);
         $Mailer = new TXmlElement('Recipient');
         $Mailer->setAttribute('ID', $this->ConditionCleaner($RCP->bho_id));
         $Mailer->setAttribute('TABLE', $RCP->bho_modul);
         $Mailer->setAttribute('NTNAME', $USER->org_ntuser);
         $Mailer->Value = mb_convert_encoding(htmlspecialchars_decode(KommunikationRecord::finder()->find('idtm_organisation=? AND kom_ismain=1 AND kom_type = 3', $RCP->idtm_organisation)->kom_information), $target_encoding);
         $Recipients->Elements[] = $Mailer;
         unset($Mailer);
     }
     $doc->Elements[] = $Recipients;
     return $doc;
 }
Exemplo n.º 28
0
 /**
  * Initializes the module.
  * This method is required by IModule and is invoked by application.
  * It loads user/role information from the module configuration.
  * @param TXmlElement module configuration
  */
 public function init($config)
 {
     $this->loadUserData($config);
     if ($this->_userFile !== null) {
         $dom = new TXmlDocument();
         $dom->loadFromFile($this->_userFile);
         $this->loadUserData($dom);
     }
     $this->_initialized = true;
 }
Exemplo n.º 29
0
 /**
  * Initialize the module from configuration file.
  * @throws TConfigurationException if {@link getConfigFile ConfigFile} is invalid.
  */
 protected function loadConfigFile()
 {
     if (is_file($this->_configFile)) {
         if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
             $config = (include $this->_configFile);
             $this->loadUrlMappings($dom);
         } else {
             $dom = new TXmlDocument();
             $dom->loadFromFile($this->_configFile);
             $this->loadUrlMappings($dom);
         }
     } else {
         throw new TConfigurationException('urlmapping_configfile_inexistent', $this->_configFile);
     }
 }
 public function onPreInit($param)
 {
     parent::onPreInit($param);
     $docname = "tempXML";
     $ext = "xml";
     $header = "application/xml";
     $target_encoding = "UTF-8";
     if (!isset($_GET['idta_berichte'])) {
         $this->idta_berichte = 0;
     } else {
         $this->idta_berichte = $_GET['idta_berichte'];
     }
     if ($this->idta_berichte == 0) {
         $myRecords = BerichteRecord::finder()->findAll();
         $doc = new TXmlDocument('1.0', $target_encoding);
         $doc->TagName = 'Reporting';
         foreach ($myRecords as $SingleReport) {
             $Report = new TXmlElement('Reports');
             $QVFile = new TXmlElement('QlikViewFile');
             $QVFile->Value = mb_convert_encoding($SingleReport->ber_local_path, $target_encoding);
             $Report->Elements[] = $QVFile;
             $BerName = new TXmlElement('ReportName');
             $BerName->Value = mb_convert_encoding($SingleReport->ber_name, $target_encoding);
             $Report->Elements[] = $BerName;
             $BerID = new TXmlElement('ReportId');
             $BerID->Value = mb_convert_encoding($SingleReport->ber_id, $target_encoding);
             $Report->Elements[] = $BerID;
             $BerMailSub = new TXmlElement('MailSubject');
             $BerMailSub->Value = mb_convert_encoding($SingleReport->ber_mail_subject, $target_encoding);
             $Report->Elements[] = $BerMailSub;
             $BerMailBody = new TXmlElement('MailBody');
             $BerMailBody->Value = mb_convert_encoding(htmlspecialchars_decode($SingleReport->ber_mail_body), $target_encoding);
             $Report->Elements[] = $BerMailBody;
             $Recipients = new TXmlElement('Recipients');
             $RCPS = BerichteOrganisationRecord::finder()->findAllByidta_berichte($SingleReport->idta_berichte);
             //schleife für alle empfänger
             foreach ($RCPS as $RCP) {
                 $USER = OrganisationRecord::finder()->findByPK($RCP->idtm_organisation);
                 $Mailer = new TXmlElement('Recipient');
                 $Mailer->setAttribute('ID', $RCP->bho_id);
                 $Mailer->setAttribute('TABLE', $RCP->bho_modul);
                 $Mailer->setAttribute('NTNAME', $USER->org_ntuser);
                 $Mailer->Value = mb_convert_encoding(htmlspecialchars_decode(KommunikationRecord::finder()->find('idtm_organisation=? AND kom_ismain=1 AND kom_type = 3', $RCP->idtm_organisation)->kom_information), $target_encoding);
                 $Recipients->Elements[] = $Mailer;
                 unset($Mailer);
             }
             $Report->Elements[] = $Recipients;
             $doc->Elements[] = $Report;
         }
     } else {
         $doc = new TXmlDocument('1.0', 'utf-8');
         $SingleReport = BerichteRecord::finder()->findByidta_berichte($this->idta_berichte);
         $doc->TagName = 'Reporting';
         $Report = new TXmlElement('Reports');
         $QVFile = new TXmlElement('QlikViewFile');
         $QVFile->Value = mb_convert_encoding($SingleReport->ber_local_path, $target_encoding);
         $Report->Elements[] = $QVFile;
         $BerName = new TXmlElement('ReportName');
         $BerName->Value = mb_convert_encoding($SingleReport->ber_name, $target_encoding);
         $Report->Elements[] = $BerName;
         $BerID = new TXmlElement('ReportId');
         $BerID->Value = mb_convert_encoding($SingleReport->ber_id, $target_encoding);
         $Report->Elements[] = $BerID;
         $BerMailSub = new TXmlElement('MailSubject');
         $BerMailSub->Value = mb_convert_encoding($SingleReport->ber_mail_subject, $target_encoding);
         $Report->Elements[] = $BerMailSub;
         $BerMailBody = new TXmlElement('MailBody');
         $BerMailBody->Value = mb_convert_encoding(htmlspecialchars_decode($SingleReport->ber_mail_body), $target_encoding);
         $Report->Elements[] = $BerMailBody;
         $Recipients = new TXmlElement('Recipients');
         $RCPS = BerichteOrganisationRecord::finder()->findAllByidta_berichte($SingleReport->idta_berichte);
         //schleife für alle empfänger
         foreach ($RCPS as $RCP) {
             $USER = OrganisationRecord::finder()->findByPK($RCP->idtm_organisation);
             $Mailer = new TXmlElement('Recipient');
             $Mailer->setAttribute('ID', $RCP->bho_id);
             $Mailer->setAttribute('TABLE', $RCP->bho_modul);
             $Mailer->setAttribute('NTNAME', $USER->org_ntuser);
             $Mailer->Value = mb_convert_encoding(htmlspecialchars_decode(KommunikationRecord::finder()->find('idtm_organisation=? AND kom_ismain=1 AND kom_type = 3', $RCP->idtm_organisation)->kom_information), $target_encoding);
             $Recipients->Elements[] = $Mailer;
             unset($Mailer);
         }
         $Report->Elements[] = $Recipients;
         $doc->Elements[] = $Report;
     }
     # $query=new TXmlElement('Query');
     # $query->setAttribute('ID','xxxx');
     # $proc->Elements[]=$query;
     #
     # $attr=new TXmlElement('Attr');
     # $attr->setAttribute('Name','aaa');
     # $attr->Value='1';
     # $query->Elements[]=$attr;
     $this->getResponse()->appendHeader("Content-Type:" . $header);
     $this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $docName . '.' . $ext);
     $doc->saveToFile('php://output');
     exit;
 }