public function getFormAgrUsr($user_id = '')
 {
     $ess_profiles = new ess_profiles();
     $profilesArray = array();
     foreach ($ess_profiles->find() as $profile) {
         $profilesArray[$profile->id] = $profile->name;
     }
     $ess_system_users = new ess_system_users();
     $myForm = new OPF_myForm('getFormAgrUsr');
     if ($user_id) {
         $ess_system_users->find($user_id);
         $myForm->addDisabled('user_name');
     }
     $myForm->styleClassForm = '';
     $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_1'), 'user_name', $ess_system_users->user_name, 15);
     $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_2'), 'name', $ess_system_users->name, 15);
     $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_3'), 'lastname', $ess_system_users->lastname, 15);
     $myForm->addPassword(OPF_myLang::getPhrase('OPF_ADMUSR_4'), 'passwd1', $ess_system_users->passwd, 15);
     $myForm->addPassword(OPF_myLang::getPhrase('OPF_ADMUSR_5'), 'passwd', $ess_system_users->passwd, 15);
     $myForm->addSelect(OPF_myLang::getPhrase('OPF_ADMUSR_6'), 'profile_id', $profilesArray, $ess_system_users->profile_id);
     $status = false;
     if ($ess_system_users->status == 1) {
         $status = true;
     }
     $myForm->addCheckBox(OPF_myLang::getPhrase('OPF_ADMUSR_7'), 'status', $status);
     $myForm->addButton('btnsave', OPF_myLang::getPhrase('LABEL_BTN_SAVE'), 'save.gif');
     $myForm->addEvent('btnsave', 'onclick', 'onClickSaveRecord', $user_id);
     return $myForm->getForm(1);
 }
 public static function formNewScaffStep2($datForm)
 {
     $myForm = new OPF_myForm('formNewScaffStep2');
     $arrTypes = array(1 => OPF_myLang::getPhrase('OPF_SCAFF_30'), 2 => OPF_myLang::getPhrase('OPF_SCAFF_31'), 3 => OPF_myLang::getPhrase('OPF_SCAFF_32'), 4 => OPF_myLang::getPhrase('OPF_SCAFF_33'), 5 => OPF_myLang::getPhrase('OPF_SCAFF_34'), 6 => OPF_myLang::getPhrase('OPF_SCAFF_35'));
     $myAct = new OPF_myActiveRecord();
     $resSql = self::getResultSelectFields($myAct, $_SESSION['temp_scaff_info']['table_name']);
     $myForm->addComment('field_etq1', '<div align="center"><b>' . OPF_myLang::getPhrase('OPF_SCAFF_16') . '</b></div>');
     $myForm->addComment('field_selec', '<div align="center"><b>' . OPF_myLang::getPhrase('OPF_SCAFF_41') . '</b></div>');
     $myForm->addComment('field_etq', '<div align="center"><b>' . OPF_myLang::getPhrase('OPF_SCAFF_17') . '</b></div>');
     $myForm->addComment('field_tipo', '<div align="center"><b>' . OPF_myLang::getPhrase('OPF_SCAFF_36') . '</b></div>');
     $myForm->addComment('field_primary', '<div align="center"><b>' . OPF_myLang::getPhrase('OPF_SCAFF_40') . '</b></div>');
     $myForm->addComment('field_required', '<div align="center"><b>' . OPF_myLang::getPhrase('OPF_SCAFF_37') . '</b></div>');
     $count = 0;
     foreach ($resSql[0] as $id => $value) {
         if (isset($_SESSION['temp_scaff_info']['form'][$id])) {
             $check = true;
             $etq = $_SESSION['temp_scaff_info']['form'][$id][0];
             $type = $_SESSION['temp_scaff_info']['form'][$id][1];
         } else {
             $check = false;
             $etq = '';
             $type = '';
             $myForm->addDisabled('req_' . $id);
             $myForm->addDisabled('etq_' . $id);
             $myForm->addDisabled('type_' . $id);
         }
         $checkReq = false;
         if (isset($_SESSION['temp_scaff_info']['form'][$id][2])) {
             if ($_SESSION['temp_scaff_info']['form'][$id][2]) {
                 $checkReq = true;
             }
         }
         $myForm->addEvent('field_' . $id, 'onclick', 'checkFormItem', 'field_' . $id, 'req_' . $id, 'etq_' . $id, 'type_' . $id);
         $myForm->addComment('etq1_' . $id, '<div align="center">' . $id . '</div>');
         $myForm->addComment('show_' . $id, '<div align="center">' . $myForm->getCheckBox('field_' . $id, $check) . '</div>');
         $myForm->addComment('etq_' . $id, $myForm->getText('etq_' . $id, $etq, 10));
         $myForm->addComment('type_' . $id, $myForm->getSelect('type_' . $id, $arrTypes, $type));
         $mark = false;
         if (!isset($_SESSION['temp_scaff_info']['pk'])) {
             if (!$count) {
                 $mark = true;
             }
         } else {
             if ($_SESSION['temp_scaff_info']['pk'] == $id) {
                 $mark = true;
             }
         }
         $myForm->addComment('req_' . $id, '<div align="center">' . $myForm->getCheckBox('req_' . $id, $checkReq) . '</div>');
         $myForm->addComment('primary_' . $id, '<div align="center">' . $myForm->getRadioButton($id, 'primary_key', $mark) . '</div>');
         ++$count;
     }
     $myForm->addButton('btn0', OPF_myLang::getPhrase('OPF_SCAFF_13'), 'back.gif');
     $myForm->addComment('cm_space', '');
     $myForm->addComment('cm_space1', '');
     $myForm->addComment('cm_space2', '');
     $myForm->addComment('cm_space3', '');
     $myForm->addButton('btn1', OPF_myLang::getPhrase('OPF_SCAFF_14'), 'next.gif');
     $myForm->addEvent('btn1', 'onclick', 'toScaffStep3');
     $myForm->addEvent('btn0', 'onclick', 'newScaff', 1);
     return $myForm->getForm(6);
 }
 /**
  * Construye el Html del formulario de consulta
  * @return string
  */
 private function buildQueryForm($showFirstRule)
 {
     $arFields = array();
     $objMyForm = new OPF_myForm($nomForm = $this->idList . 'QueryForm');
     $objMyForm->width = '98%';
     $objMyForm->border = 0;
     $objMyForm->styleClassTags = 'texto_formularios';
     $objMyForm->styleClassForm = 'form_cont_filter';
     $htble = '';
     /**
      * Helps
      */
     $objMyForm->styleTypeHelp = 2;
     $objMyForm->addDisabled('cancel_query_' . $this->idList);
     $objMyForm->addDisabled('save_query_' . $this->idList);
     $htble .= '<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>';
     $anyBut = false;
     $objMyForm->addHelp('pdf_' . $this->idList, LABEL_HELP_PDF_BUTTON_FORM);
     if (!$this->arrayDataTypeExport['pdf']) {
         $objMyForm->addDisabled('pdf_' . $this->idList);
     } else {
         $anyBut = true;
     }
     $objMyForm->addEvent('pdf_' . $this->idList, 'onclick', 'MYLIST_exportData', 'pdf', $this->idList);
     $htble .= '<td width="10%" align="left">' . $objMyForm->getButton('pdf_' . $this->idList, '', 'pdf.gif') . '</td>';
     $objMyForm->addHelp('xls_' . $this->idList, LABEL_HELP_EXCEL_BUTTON_FORM);
     if (!$this->arrayDataTypeExport['xls']) {
         $objMyForm->addDisabled('xls_' . $this->idList);
     } else {
         $anyBut = true;
     }
     $objMyForm->addEvent('xls_' . $this->idList, 'onclick', 'MYLIST_exportData', 'xls', $this->idList);
     $htble .= '<td width="10%" align="left">' . $objMyForm->getButton('xls_' . $this->idList, '', 'excel.gif') . '</td>';
     $objMyForm->addHelp('html_' . $this->idList, LABEL_HELP_HTML_BUTTON_FORM);
     if (!$this->arrayDataTypeExport['html']) {
         $objMyForm->addDisabled('html_' . $this->idList);
     } else {
         $anyBut = true;
     }
     $objMyForm->addEvent('html_' . $this->idList, 'onclick', 'MYLIST_exportData', 'html', $this->idList);
     $htble .= '<td width="10%" align="left">' . $objMyForm->getButton('html_' . $this->idList, '', 'html.gif') . '</td>';
     if (!$anyBut) {
         $objMyForm->addDisabled('not_pg_' . $this->idList);
     }
     $htble .= '<td width="10%">&nbsp;</td>';
     $htble .= '<td width="10%">&nbsp;</td>';
     $htble .= '<td width="10%">&nbsp;</td>';
     $objMyForm->addEvent('help_' . $this->idList, 'onclick', 'MYLIST_help');
     $objMyForm->addHelp('help_' . $this->idList, TITLE_WINDOW_HELP_MYLIST);
     $htble .= '<td width="10%" align="right">' . $objMyForm->getButton('help_' . $this->idList, '', 'help.gif') . '</td>';
     $objMyForm->addHelp($this->idList . '_reload_list', LABEL_HELP_RELOAD_LIST_FORM);
     $objMyForm->addEvent($this->idList . '_reload_list', 'onclick', 'MYLIST_reload', $this->idList);
     $htble .= '<td width="10%" align="right">' . $objMyForm->getButton($this->idList . '_reload_list', NULL, 'reload.gif') . '</td>';
     $objMyForm->addHelp($this->idList . '_apply_rule', LABEL_HELP_APPLY_RULE_FORM);
     $objMyForm->addEvent($this->idList . '_apply_rule', 'onclick', 'MYLIST_applyRuleQuery', $this->idList);
     $htble .= '<td width="10%" align="right">' . $objMyForm->getButton($this->idList . '_apply_rule', NULL, 'ok.gif') . '</td>';
     $objMyForm->addHelp('add_rule_' . $this->idList, LABEL_HELP_ADD_RULE_QUERY_BUTTON_FORM);
     $objMyForm->addEvent('add_rule_' . $this->idList, 'onclick', 'MYLIST_addRuleQuery', $this->idList, $showFirstRule);
     $htble .= '<td width="10%" align="right">' . $objMyForm->getButton('add_rule_' . $this->idList, '', 'find.gif') . '</td>';
     $htble .= '</tr></table>';
     $objMyForm->addComment('options', $htble);
     $htmFirstRule = '';
     if ($showFirstRule) {
         $htmFirstRule = $this->getFirstRuleOnQueryForm();
     }
     $objMyForm->addComment('rule_for', '<div class="form_rule_for_list" id="rule_for_' . $this->idList . '">' . $htmFirstRule . '</div>');
     return $objMyForm->getForm(1);
 }
 public function getFormInstall($type, $datForm = '', $disabled = false)
 {
     $myForm = new OPF_myForm('install_essentials');
     $arEngine = array('mysql' => 'MySQL', 'pgsql' => 'PostgreSQL');
     $myForm->setParamTypeOnEvent('field');
     $myForm->addEvent('engine', 'onchange', 'onChangeEngine');
     $myForm->setParamTypeOnEvent('global');
     $engine = '';
     if (isset($datForm['engine'])) {
         $engine = $datForm['engine'];
     }
     if ($disabled) {
         $myForm->addDisabled('engine');
     }
     $myForm->addSelect(OPF_myLang::getPhrase('OPF_LOGIN_8'), 'engine', $arEngine, $engine);
     $db = '';
     if (isset($datForm['db'])) {
         $db = $datForm['db'];
     }
     $myForm->addText(OPF_myLang::getPhrase('OPF_LOGIN_12'), 'db', $db);
     $encoding = 'UTF8';
     if (isset($datForm['encoding'])) {
         $encoding = $datForm['encoding'];
     }
     $myForm->addDisabled('encoding');
     $myForm->addText(OPF_myLang::getPhrase('OPF_LOGIN_12A'), 'encoding', $encoding);
     $user_db = '';
     if (isset($datForm['user_db'])) {
         $user_db = $datForm['user_db'];
     }
     $myForm->addText(OPF_myLang::getPhrase('OPF_LOGIN_9'), 'user_db', $user_db);
     $passwd_db = '';
     if (isset($datForm['passwd_db'])) {
         $passwd_db = $datForm['passwd_db'];
     }
     $myForm->addPassword(OPF_myLang::getPhrase('OPF_LOGIN_10'), 'passwd_db', $passwd_db);
     $host_db = '';
     if (isset($datForm['host_db'])) {
         $host_db = $datForm['host_db'];
     }
     $myForm->addText(OPF_myLang::getPhrase('OPF_LOGIN_11'), 'host_db', $host_db);
     $host_port = '';
     if (isset($datForm['host_port'])) {
         $host_port = $datForm['host_port'];
     }
     $myForm->addText(OPF_myLang::getPhrase('OPF_LOGIN_13'), 'host_port', $host_port, NULL, 5, true);
     if ($type == 'tables') {
         $str = OPF_myLang::getPhrase('OPF_LOGIN_30');
         $myForm->addButton('btn_install', OPF_myLang::getPhrase('OPF_LOGIN_14'), 'list.gif');
         $myForm->addEvent('btn_install', 'onclick', 'onClickInstall');
     } else {
         $str = OPF_myLang::getPhrase('OPF_LOGIN_29');
         if ($disabled) {
             $myForm->addDisabled('btn_install');
         }
         $myForm->addButton('btn_install', OPF_myLang::getPhrase('OPF_LOGIN_17'), 'add.gif');
         $myForm->addEvent('btn_install', 'onclick', 'onClickCreateBD');
     }
     $myForm->addGroup('grp1', $str, array('engine', 'db', 'encoding', 'user_db', 'passwd_db', 'host_db', 'host_port'), 1);
     return $myForm->getForm(1);
 }