Пример #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);
     }
 }
Пример #2
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;
         }
     }
 }
Пример #3
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);
     }
 }
Пример #4
0
 /**
  * @param string $xml xml data of the tracking
  * @return string Return the database dump
  * @soapmethod
  */
 public function syncTrackingTable($xml)
 {
     $doc = new TXmlDocument('1.0', 'utf-8');
     $doc->loadFromString($xml);
     // mains tracking table
     $tableArray["hr_tracking"] = array();
     $tableArray["hr_alarms"] = array();
     $nreOfRecord = 0;
     $ids = '';
     if ("trackingDump" == $doc->getTagName()) {
         if ($doc->getHasElement()) {
             if ($doc->getElements()->itemAt(0)->getHasElement()) {
                 $tables = $doc->getElements()->itemAt(0)->getElements();
                 $tablesName = "";
                 foreach ($tables as $table) {
                     if ($table->getHasElement()) {
                         $tableName = $table->getTagName();
                         $records = $table->getElements()->itemAt(0)->getElements();
                         foreach ($records as $record) {
                             if ($record->getHasElement()) {
                                 $fields = $record->getElements();
                                 $recordArray = array();
                                 foreach ($fields as $field) {
                                     $fieldName = $field->getTagName();
                                     $fieldValue = $field->getValue();
                                     $recordArray[$fieldName] = $fieldValue;
                                 }
                                 $tableArray[$tableName][] = $recordArray;
                             }
                         }
                     }
                 }
                 $ids .= $this->syncAlarm($tableArray["hr_alarms"]);
                 if ($ids != "") {
                     $ids .= ",";
                 }
                 $ids .= $this->syncTracking($tableArray);
                 return $ids;
             } else {
                 return "0";
             }
         } else {
             return "0";
         }
     } else {
         return "0";
     }
 }