public function __construct($nA, $nM, $nDp, $update, $form_name = '') { $nDp = intval($nDp); $sw = false; $nSem = intval(date('W', mktime(0, 0, 0, $nM, 1, $nA))); $nDsh = $nMsh = ''; $arrMonth = array(); foreach ($this->arrMonth as $id => $month) { $arrMonth[$nDp . '_' . $id . '_' . $nA] = $month; } /** * Construimos un arreglo de datos para los años */ for ($aIni = $nA - 30; $aIni < $nA + 5; ++$aIni) { if ($aIni >= 1902) { $this->arrYears[$nDp . '_' . $nM . '_' . $aIni] = $aIni; } } $objMyForm = new OPF_myForm(); $iniCell = '<td class="cellday" onmouseover="this.className=\'cellday_over\'" onmouseout="this.className=\'cellday\'" {onclick}>'; $endCell = '</td>'; $htm = ''; $htm .= '<table cellpadding="0" cellspacing="0"><tr><td class="tablecal">'; $htm .= '<table cellpadding="1" cellspacing="1" border=0>'; $htm .= '<tr>'; $htm .= '<td class="celldays">' . CAL_WK_LABEL . '</td>'; foreach ($this->arrDsem as $id => $le) { $htm .= '<td class="celldays">' . $le . '</td>'; } $htm .= '</tr>'; $nDmax = date('d', mktime(0, 0, 0, $nM + 1, 0, $nA)); $nD = 1; $cDpm = 1; $fNdf = 0; $cDam = 0; $toShow = true; while ($nD <= $nDmax) { foreach ($this->arrDsem as $id => $le) { $w = date('N', mktime(0, 0, 0, $nM, $nD, $nA)); if ($w == 1 || !$sw) { $htm .= '<tr>'; $sw = true; $htm .= '<td class="cell_week">' . $nSem . '</td>'; } if ($nD <= $nDmax) { if ($w == $id) { $nMsh = $nM; if ($nM < 10) { $nMsh = '0' . $nM; } $nDsh = $nD; if ($nD < 10) { $nDsh = '0' . $nD; } if (!$fNdf) { $fNdf = $id; } $onclick = 'onclick="selectDate(\'' . $nA . '-' . $nMsh . '-' . $nDsh . '\',\'' . $update . '\',\'' . $form_name . '\')"'; $iniA = '<a href="javascript:;" class="celldays_a" ' . $onclick . '>'; $endA = '</a>'; if ($nM . $nD . $nA == date('mjY')) { $htm .= '<td class="cellday_today" ' . $onclick . '>' . $iniA . $nD . $endA . $endCell; } else { $htm .= str_replace('{onclick}', $onclick, $iniCell) . $iniA . $nD . $endA . $endCell; } ++$nD; } else { if (!$cDam) { $cDam = date('t', mktime(0, 0, 0, $nM, 0, $nA)) - ($w - 2); } $htm .= $iniCell . '<div class="cell_other_days">' . $cDam . '</div>' . $endCell; ++$cDam; } } else { $htm .= $iniCell . '<div class="cell_other_days">' . $cDpm . '</div>' . $endCell; ++$cDpm; } } $nSem = intval(date('W', mktime(0, 0, 0, $nM, $nD, $nA))); } $objMyForm->setParamTypeOnEvent('field'); $objMyForm->selectUseFirstValue = false; $objMyForm->styleClassFields = 'select_calendar'; $objMyForm->addEvent('cal_month', 'onchange', 'MYFORM_calOnChange', $update, $form_name); $objMyForm->addEvent('cal_year', 'onchange', 'MYFORM_calOnChange', $update, $form_name); $objMyForm->addEvent('close_call', 'onclick', 'closeCalendarWindow', $update); $htm .= '<tr>'; $htm .= '<td colspan="8" class="cell_control">' . '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>' . '<td>' . $objMyForm->getSelect('cal_month', $arrMonth, $nDp . '_' . $nM . '_' . $nA) . '</td>' . '<td>' . $objMyForm->getSelect('cal_year', $this->arrYears, $nDp . '_' . $nM . '_' . $nA) . '</td>' . '<td align="right">' . $objMyForm->getButton('close_call', 'X') . '</td>' . '</tr></table>' . '</td>'; $htm .= '</tr>'; $htm .= '</table>'; $htm .= '</td></tr></table>'; $this->calOut = $htm; }
private function getFirstRuleOnQueryForm() { $html = ''; if (count($this->arrayAliasSetInQuery) && $this->numAffectedRows) { $arFields = array(); $objMyForm = new OPF_myForm($idForm = $this->idList . 'QueryForm'); $objMyForm->cellPadding = 0; $objMyForm->styleTypeHelp = 2; $objMyForm->selectUseFirstValue = false; ++$this->numRuleQuery; $html .= '<table border="0" id="rule_gp_' . $this->idList . '_' . $this->numRuleQuery . '" width="100%" cellpadding="0" cellspacing="0">'; $html .= '<tr>'; $html .= '<td width="10%" align="center"><div id="status_' . $this->idList . '_' . $this->numRuleQuery . '" class="rule_cancel" id=""></div></td>'; $objMyForm->addHelp('logic_' . $this->numRuleQuery, LABEL_LOGIC_FIELD_ADD_RULE_FORM); $html .= '<td width="20%" align="center">' . $objMyForm->getHidden('logic_' . $this->numRuleQuery, 'AND') . '</td>'; foreach ($this->arrayFieldsOnQuery as $field) { if (!isset($this->arrayEventOnColumn[$field]) && isset($this->arrayAliasSetInQuery[$field])) { $etq = $field; if (isset($this->arrayAliasSetInQuery[$field])) { $data = $this->arrayAliasSetInQuery[$field]; } else { $data = $field; } $arFields[$field] = $etq; } } $objMyForm->addHelp('field_' . $this->numRuleQuery, LABEL_FIELD_LIST_ADD_RULE_FORM); $html .= '<td width="20%" align="center">' . $objMyForm->getSelect('field_' . $this->numRuleQuery, $arFields) . '</td>'; $spaCha = ' '; $objMyForm->addEvent('relation_' . $this->numRuleQuery, 'onchange', 'MYLIST_caseSensitiveCheckBox', 'case_sensitive_' . $this->numRuleQuery, 'relation_' . $this->numRuleQuery); $objMyForm->addHelp('relation_' . $this->numRuleQuery, LABEL_RELATION_FIELD_ADD_RULE_FORM); $html .= '<td width="20%" align="center">' . $objMyForm->getSelect('relation_' . $this->numRuleQuery, $this->myDinamicListRel) . '</td>'; $objMyForm->addHelp('value_' . $this->numRuleQuery, LABEL_FIELD_VALUE_ADD_RULE_FORM); $objMyForm->addHelp('case_sensitive_' . $this->numRuleQuery, LABEL_CASE_SENSITIVE_LIST_ADD_RULE_FORM); $html .= '<td width="20%" align="center"><table cellpadding="0" border="0" cellspacing="0"><tr><td>' . $objMyForm->getText('value_' . $this->numRuleQuery, NULL, 12) . '</td><td>' . $objMyForm->getCheckBox('case_sensitive_' . $this->numRuleQuery) . '</td></tr></table></td>'; $objMyForm->addHelp($this->idList . '_remove_rule_' . $this->numRuleQuery, LABEL_HELP_REM_RULE_FORM); $objMyForm->addEvent($this->idList . '_remove_rule_' . $this->numRuleQuery, 'onclick', 'MYLIST_removeRuleQuery', $this->idList, $this->numRuleQuery); $html .= '<td align="center">' . $objMyForm->getButton($this->idList . '_remove_rule_' . $this->numRuleQuery, NULL, 'remove.gif') . '</td>'; $html .= '</tr>'; $html .= '</table>'; } return $html; }
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); }
/** * Abre una ventana modal con un formulario que permite agregar una regla a la consulta actual de la lista dinamica. * @ignore * @param $datForm Datos de form * @param $idList Id lista * @return string */ public function MYLIST_addRuleQuery($datForm, $idList, $showFirstRule) { $objList = new OPF_myList($idList); $arAlsInQry = $objList->getVar('arrayAliasSetInQuery'); if ($objList->getVar('numAffectedRows')) { if (count($arAlsInQry)) { $objMyForm = new OPF_myForm($idForm = $idList . 'QueryForm'); $objMyForm->cellPadding = 0; $objMyForm->styleTypeHelp = 2; $objMyForm->selectUseFirstValue = false; $arFields = array(); $arFldOnQry = $objList->getVar('arrayFieldsOnQuery'); $arEvnOnClm = $objList->getVar('arrayEventOnColumn'); $objList->setVar('numRuleQuery', $numRuleQuery = $objList->getVar('numRuleQuery') + 1); $html = '<table border="0" id="rule_gp_' . $idList . '_' . $numRuleQuery . '" width="100%" cellpadding="0" cellspacing="0">'; $html .= '<tr>'; $html .= '<td width="10%" align="center"><div id="status_' . $idList . '_' . $numRuleQuery . '" class="rule_cancel" id=""></div></td>'; $objMyForm->addHelp('logic_' . $numRuleQuery, LABEL_LOGIC_FIELD_ADD_RULE_FORM); $html .= '<td width="20%" align="center">' . $objMyForm->getSelect('logic_' . $numRuleQuery, array('AND' => LABEL_RELATION_OPTAND_ADD_RULE_FORM, 'OR' => LABEL_RELATION_OPTOR_ADD_RULE_FORM)) . '</td>'; foreach ($arFldOnQry as $field) { if (!isset($arEvnOnClm[$field]) && isset($arAlsInQry[$field])) { $etq = $field; if (isset($arAlsInQry[$field])) { $data = $arAlsInQry[$field]; } else { $data = $field; } $arFields[$field] = $etq; } } $objMyForm->addHelp('field_' . $numRuleQuery, LABEL_FIELD_LIST_ADD_RULE_FORM); $html .= '<td width="20%" align="center">' . $objMyForm->getSelect('field_' . $numRuleQuery, $arFields) . '</td>'; $spaCha = ' '; $objMyForm->addEvent('relation_' . $numRuleQuery, 'onchange', 'MYLIST_caseSensitiveCheckBox', 'case_sensitive_' . $numRuleQuery, 'relation_' . $numRuleQuery); $objMyForm->addHelp('relation_' . $numRuleQuery, LABEL_RELATION_FIELD_ADD_RULE_FORM); $html .= '<td width="20%" align="center">' . $objMyForm->getSelect('relation_' . $numRuleQuery, $this->myDinamicListRel) . '</td>'; $objMyForm->addHelp('value_' . $numRuleQuery, LABEL_FIELD_VALUE_ADD_RULE_FORM); $objMyForm->addHelp('case_sensitive_' . $numRuleQuery, LABEL_CASE_SENSITIVE_LIST_ADD_RULE_FORM); $html .= '<td width="20%" align="center"><table cellpadding="0" border="0" cellspacing="0"><tr><td>' . $objMyForm->getText('value_' . $numRuleQuery, NULL, 12) . '</td><td>' . $objMyForm->getCheckBox('case_sensitive_' . $numRuleQuery) . '</td></tr></table></td>'; $objMyForm->addHelp($idList . '_remove_rule_' . $numRuleQuery, LABEL_HELP_REM_RULE_FORM); $objMyForm->addEvent($idList . '_remove_rule_' . $numRuleQuery, 'onclick', 'MYLIST_removeRuleQuery', $idList, $numRuleQuery); $html .= '<td align="center">' . $objMyForm->getButton($idList . '_remove_rule_' . $numRuleQuery, NULL, 'remove.gif') . '</td>'; $html .= '</tr>'; $html .= '</table>'; $this->append('rule_for_' . $idList, 'innerHTML', $html); $chkPref = 'case_sensitive_'; $len = strlen($chkPref); foreach ($datForm as $id => $value) { if (!strcmp(substr($id, 0, $len), $chkPref)) { if ($datForm[$id]) { $this->assign($id, 'checked', true); } } else { $this->assign($id, 'value', $value); } } if (!$showFirstRule) { $this->script("blockFirstElementForm('" . $idForm . "')"); } } else { $this->notificationWindow(MSG_FAILED_SHOW_FILTER_MUST_PROVIDE_REAL_NAME, 4, 'warning'); } } else { $this->notificationWindow(MSG_FAILED_SHOW_FILTER_NO_RECORDS_FOUND, 4, 'warning'); } return $this->response; }