public function show($res) { $model = Model::getModel(); $actions = $model->getResProperty2($res->items[5048], 5012); //5012.Осуществление $check = 0; if (!empty($actions)) { foreach ($actions as $action) { $check = $model->checkPermission($action); if ($check) { break; } } } if (empty($actions)) { $check = 1; } if ($check) { $viewer = Model::getModel()->getViewer(128, null, $model); echo $viewer->show($res, null); if (!empty($res->items[5056])) { $ref = "href='" . $res->items[5056] . "'"; } $filters[5057] = '%COLUMN%=' . $res->items[5048]; //child->pid = id $orders[504] = 1; $result = $model->getResources(113, $filters, $orders); if (!empty($result)) { foreach ($result as $child) { $this->show($child); } } echo $viewer->footerShow($res, null); } }
public function _init() { /* * Auto bind the model * * If the controller -class has defined the variable "bindModelName", then we use the name in that variable, * otherwise use the name of controller * * Example: * * class FoobarController extends Controller { * var $bindModelName = "users"; * } * * This would cause the controller to automatically bind to model "users" instead of "foobar" * */ $this->autoBindModel = Model::getModelIfExists(empty($this->bindModelName) ? $this->controllerName : $this->bindModelName); /* * Add the AUTOLOAD -models to this Controller. Autoload -models are models * which are always available via $this->Modelname in all controllers */ if (property_exists('AppConfiguration', 'AUTOLOAD_MODELS')) { foreach (AppConfiguration::$AUTOLOAD_MODELS as $model) { $casedName = Inflector::camelize($model); $this->{$casedName} = Model::getModel($model); } } }
public function find($params) { $filt_array = preg_split("/[\\s,]+/", strtoupper($params['5091'])); $fltrs = ""; foreach ($filt_array as $item) { if ($fltrs != "") { $fltrs = $fltrs . ' AND '; } $fltrs = $fltrs . 'UPPER(%COLUMN%) LIKE "%' . $item . '%"'; } $filters[50100] = $fltrs; $orders[501] = 1; $model = Model::getModel(); $list = $model->getResourcesGen($filters, $params['5055'], $orders); if (!empty($list)) { foreach ($list as $element) { $active = ""; if ($params['5066'] == $element->items[5048]) { $active = " active"; } if (empty($params[50202])) { $reqFlag = 'false'; } else { $reqFlag = true; } $rets['0'] = $rets['0'] . '<span id="group_item_' . $element->items[5048] . '" class="list-group-item' . $active . '" style="cursor: pointer" onclick="data[\'' . $params['50185'] . '\'][\'' . $params['5013'] . '\'][\'' . $params['5082'] . '\'][0]=' . $element->items[5048] . ';data[\'50129\']=' . $params['50185'] . '; data[\'50146\']=' . $params['5013'] . '; data[\'' . $params['50185'] . '\'][\'5058\']=2334; sendForm2(' . $params[50185] . ',' . $reqFlag . ',\'' . $params[50202] . '\');">' . $element->items[501] . '</span>'; } } else { $rets['0'] = $rets['0'] . '<br>'; } return $rets; }
public function execute($params) { $model = Model::getModel(); $paramSetId = $params[50109]; $formCounter = $params[5065]; //5065.Форма if (empty($formCounter)) { $formCounter = 1; } $actionId = $model->getResProperty($paramSetId, 5058); //5058.Действие $action = $model->getAction($actionId); $domain = $action->items[5055]; $filters[50109] = '%COLUMN%=' . $paramSetId; //5058.Действие $orders[504] = 1; $actionFilters = $model->getResources(163, $filters, $orders); echo '<script language ="JavaScript">var data = {}; data["' . $formCounter . '"]={}; data["' . $formCounter . '"]["50109"] = ' . $paramSetId . '; data["' . $formCounter . '"]["5058"] = ' . $actionId . '; t={}; t["5079"]= ' . $_SESSION['id'] . '; t["50127"]="' . $_SESSION['hash'] . '";data["50126"]=t;data["' . $formCounter . '"]["5055"]=' . $domain . '; data["50129"]=' . $formCounter . '; data["5058"]=2316;</script>'; if (!empty($actionFilters)) { echo '<div id="data_container_header">'; echo ' <script language ="JavaScript">var filters = {}; data["' . $formCounter . '"]["5095"] = filters;</script>'; foreach ($actionFilters as $aFilter) { echo $aFilter->items[501]; $filters4[5048] = '%COLUMN% = 148'; $contr = $model->getResources(14, $filters4); require_once substr($contr[0]->items[503], 5); //503.Местоположение $contr = new $contr[0]->items[501](); //501.Название $params2[5048] = $aFilter->items[5048]; $params2[5082] = $aFilter->items[5082]; $filters2[5048] = '%COLUMN%=' . $aFilter->items[5094]; //5094.Значение по умолчанию if (!empty($aFilter->items[5094])) { $defValue = $model->getResources(162, $filters2); } $filters3[$aFilter->items[5082]] = $defValue[0]->items[5096]; //5096.SQL,5082.Идентификатор свойства $model->log("ExtShowController: ParamSetId=" . $paramSetId . ", PropId=" . $aFilter->items[5082] . ", DefaultValue=" . $aFilter->items[5094] . ", SQL=" . $defValue[0]->items[5096]); $params2[5094] = $aFilter->items[5094]; $contr->execute($params2); } //echo '<a onclick="sendData(2316);">Применить</a>'; echo '</div>'; } $params[5095] = $filters3; $params[5058] = $actionId; $params[50149] = 1; $params[50147] = $filters3[50147]; $mainController = Controller::getController(); $ret = $mainController->executeAction($actionId, $params); return $ret; }
public function func() { $model = Model::getModel("User"); if ($model->save($this->input)) { $this->redirect("/foo/login"); return; } else { list($foo, $control, $method) = explode("/", "/foo/bar"); MVC::executeController($control, $method, array(), "/foo/bar", array(), "", array("MVC_CURRENT_MODEL" => $model)); exit; } }
public function execute($params) { $model = Model::getModel(); $formId = $params[5065]; //5065.Форма if (empty($formId)) { $formId = 1; } $filterId = $params[5048]; $filters2[5048] = '%COLUMN%=' . $filterId; //5095.Фильтр $filter = $model->getResources(163, $filters2); //print_r($filter); $filters[5095] = '%COLUMN%=' . $filter[0]->items[5095]; //5095.Фильтр if (!empty($filter[0]->items[5095])) { $fields = $model->getResources(162, $filters); } //$propId = $filter[0]->items[5082]; $propId = $params[5082]; //print_r($filter[0]); $viewerId = $filter[0]->items[50178]; if (empty($viewerId)) { if (!empty($params[5094])) { $defValue = $params[5094]; } else { $defValue = $filter[0]->items[5094]; } echo ' <script language ="JavaScript">data["' . $formId . '"]["5095"]["' . $propId . '"] = ' . $defValue . '; </script>'; //5094.Значение по умолчанию //echo '<script language ="JavaScript">data["'.$formId.'"]["5095"]["'.$filterId.'"]=</script>'; echo "<select onchange='editFilter(" . $formId . "," . $params[5082] . ",this.options[this.selectedIndex].value); data[\"" . $formId . "\"][\"50149\"]=1; sendData2(data,data_container,false);'>"; foreach ($fields as $field) { if ($field->items[5048] == $defValue) { $selected = 'selected'; } else { $selected = ''; } echo "<option value = '" . $field->items[5048] . "' " . $selected . ">" . $field->items[501] . '</option>'; } echo '</select>'; } else { $viewer = $model->getViewer($viewerId); $params2[5065] = $formId; //5065.Форма; $params2[5082] = $params[5082]; $result = $viewer->show($filter[0], $params2); echo $result[0]; } }
public function execute() { $model = Model::getModel(); if (!empty($_REQUEST['domain'])) { $classId = $_REQUEST['domain']; } else { $classId = $model->getResProperty($_REQUEST['id'], 5051, 0); } //Тип $elem = $model->getEShowElement($classId); if (!empty($_REQUEST['domain'])) { $localId = $_REQUEST['id']; } else { $localId = substr($_REQUEST['id'], 3); } $this->redirect("index.php?elem={$elem}&id=" . $localId); }
public function execute($iParams) { $model = Model::getModel(); $resource2 = $iParams[5013]; //5013.Объект $formId = $iParams[5065]; //5065.Форма $domain = $iParams[5055]; //5055.Домен $model->log("EditController, START, Domain=" . $iParams[5055] . " FormId=" . $iParams[5065] . ", Id=" . $resource2->items[5048][0]); //echo "FORM_ID".$formId; if (!empty($resource2->items[5048][0])) { $model->update($resource2, $formId); } else { $model->insert($resource2, $domain); } $model->log("EditController, FINISH"); }
public function find($params) { $model = Model::getModel(); $domain = $params[5055]; //5055.Домен echo $domain; $model->find($params[5091], $domain); //5091.Поисковый запрос $action = $model->getLeafAction(2316, $domain); $params2[5058] = $action->items[5048]; //5058.Действие $params2[50125] = 1; //50125.Флаг поискового запроса $params2[5055] = $domain; //5055.Домен $mainContriller = Controller::getController(); $mainContriller->executeAction(2316, $params2); //2316.Просмотр сущностей класса }
public function execute($iParams) { $model = Model::getModel(); //$id = $iParams[5048] ; $pAction = $model->getAction($iParams[5058]); //5058.Действие print_r($pAction); $domain = $pAction->items[5055]; //5055.Домен echo 'Domain=' . $domain; //$id = $model->getId($domain) ; $elemId = $pAction->items[5065]; //5065.Форма //$items[5048][0]=$id; $items[5051][0] = $domain; $resource2 = new Resource2($items); /* $nEntsIds = $model->getResProperty2($domain,50216);//50216.Домен if (!empty($nEnt)) foreach ($nEntsIds as $nEntId){ $items2[5051][0]=$nEntId; $nEnt = new Resource2($items2); $nEntInstId=$model->insert($nEnt,$domain); $resource2->items[]=$nEntInstId; } */ $id = $model->insert($resource2, $domain); $java = "<script language =\"JavaScript\">\n\t\twindow.onload = function () {\ndata={};\ndata['50130']=1;\ndata['50126']={};\ndata['50126']['5079']=" . $model->user_id . ";\ndata['5058']='';\ndata['50129']='1';\ndata['1']={};\ndata['1']['5058']=2354;\ndata['1']['5055']=111;\ndata['1']['5095']={};\ndata['1']['5095']['5048']='%COLUMN%=" . $elemId . "';\ndata['1']['50178']=1221;\ndata['1']['50181']='#main_data_container';\ndata['1']['50186']={};\ndata['1']['50186']['5048']=" . $id . ";\ndata['1']['50186']['5055']=" . $domain . "; \ndata['1']['50202']=1; \n//alert('send');\n//alert(data['1']['5095']['5048']);\n\t\tsendForm(1);}</script>"; echo $java; $params2[5048] = $id; //5048.Идентификатор $params2[5014] = $elemId; //5014.Исполнитель $params2[5055] = $domain; //5055.Домен $params2[15132] = 1; //15132.Флаг создания //echo 'Form:'.$elemId; /* require_once('eshow.controller.php'); $contr = new EshowController(); $contr->execute($params2); */ }
public function execute($params) { $type = $params[5055]; //5055.Домен $query = $params[5091]; //5091.Поисковый запрос $viewer = $params[50178]; //50178.Отображатель $filters = $params[5095]; //5095.Фильтр //echo "QUERY=".$query."VIEWER=".$viewer; $model = Model::getModel(); $model->log("ListController: DOMAIN=" . $type . ", QUERY=" . $query . ", VIEWER=" . $viewer); if (!empty($query)) { $filters[50139] = "UPPER(%COLUMN%) LIKE '%" . strtoupper($query) . "%'"; } //print_r($filters); $results = $model->getResources2Opt($type, $filters); //print_r($results); //echo 'Viewer='.$viewer; if (!empty($viewer)) { $viewerEnt = $model->getViewer($viewer, $params[50186], $model); } //print_r($results); if (!empty($results)) { foreach ($results as $result) { //echo 'Viewer='.$result->items[50178][0]; //if (!empty($params[50186][$result->items[5055]])) $viewerParams = $params[50186][$result->items[5055]]; else $viewerParams = $params[50186]; if (empty($viewer)) { $viewerEnt = $model->getViewer($result->items[50178][0], $params[50186], $model); } $result = $viewerEnt->show($result, $params[50186]); $ret['0'] = $ret['0'] . $result['0']; $ret['1'] = $ret['1'] . $result['1']; } } //echo $ret[1]; return $ret; //echo $ret[0]; //echo 'ListController'; }
public function execute($iParams) { if (empty($iParams[50130])) { $formCounter = 1; } else { $formCounter = ++$iParams[50130]; } $model = Model::getModel(); $id = $iParams[5048]; //5048.Идентификатор $elemId = $iParams[5014]; //5014.Исполнитель $actionId = $iParams[5058]; if ($iParams[15132] == 1) { $executeAction = 2345; } else { $executeAction = 2334; } //2345.Создание сущности, 2334.Изменение сущности $userId = $_SESSION['id']; if (empty($userId)) { $userId = $iParams[50126][5079]; } //50126.Технические параметры, 5079.Пользователь $domain = $iParams[5055]; echo 'FLAG=' . $iParams[15132]; if (empty($elemId) && !empty($id) && $iParams[15132] != 1) { $domain = $model->getResProperty($id, 5051, 0); //5051.Type $elemId = $model->getForm($actionId, $domain); } if (empty($id)) { $id = 0; } echo ' <script language ="JavaScript">var data = {}; t={}; t["5079"]= ' . $userId . '; t["50127"]="' . $_SESSION['hash'] . '";data["50126"]=t; data["50129"]=' . $formCounter . '; data["50130"]=' . $formCounter . '; data["' . $formCounter . '"]={};data["' . $formCounter . '"]["5065"] = ' . $elemId . '; data["' . $formCounter . '"]["' . $id . '"]={};data["' . $formCounter . '"]["5055"]=' . $domain . ';data["' . $formCounter . '"]={};data["' . $formCounter . '"]["' . $id . '"]={};</script>'; //$this->printJavaScript(5055,$iParams[5055],0,0,$formCounter);//5055.Домен $val = $model->getColumns2($elemId); $viewerData = array(); $viewerData[5093] = $val->cols; $lineNum = 0; if (!empty($id) && $id != 0 && $iParams[15132] != 1) { $resource2 = $model->getCurrentResource2($id); } //else {echo '<script language ="JavaScript">data['.$formCounter.'][5051] = mas'.$formCounter.'_0;</script>';} if (!empty($val->cols)) { foreach ($val->cols as $col_value) { $propId = $col_value->property; $params[5013] = $id; $params[5082] = $propId; $params[5055] = $col_value->domain; //507.Представление $params[5042] = $col_value->editable; //5042.Редактируемость $params[507] = $col_value->domain; //507.Представление $params[5082] = $col_value->property; //5082.Идентификатор свойства $params[5088] = 0; //5088.Номер значение $params[50129] = $formCounter; $params[5048] = $id; //5048.Идентификатор сущности $params2[5055] = $col_value->domain; //5055.Домен $viewer = $model->getViewer($col_value->viewer, $params2, $model); if (!empty($resource2->items[$propId])) { foreach ($resource2->items[$propId] as $valueCounter => $propValue) { $params[5066] = $propValue; //$propId = $col_value->property; if ($col_value->type == 0) { $idValue = $resource2->items[$propId][$valueCounter]; $value = $model->getResourceValue($idValue, $col_value->value_template); } else { $value = $resource2->items[$propId][$valueCounter]; $idValue = $value; } $cell = new Cell($idValue, $value); $echo = $viewer->show($cell, $params); $viewerData[50115][$propId][$valueCounter] = $echo; //50115.Набор свойств для отображения $this->printJavaScript($formCounter, $id, $col_value->property, $valueCounter, $idValue); } } else { $this->printJavaScript($formCounter, $id, $col_value->property, 0, null); $cell = new Cell(null, null); $viewerData[50115][$propId][0] = $viewer->show($cell, $params); } $lineNum++; } } require_once 'templates/eshow.template.php'; }
public function loadPermissions($userId){ $model = Model::getModel(); $model->user_id = $userId; $model->loadPermissions(); }
public function execute($iParams) { //echo 'AnalogBaseController'; $controller = Controller::getController(); $model = Model::getModel(); $filters[5057] = "%COLUMN%=1525171"; // $ret = $model->getResources(1017, $filters); // Список типов техники $filters[5057] = "%COLUMN%=1525170"; // $ret2 = $model->getResources(1017, $filters); // Группы техники $filters[50178] = "%COLUMN%=1"; // $ret3 = $model->getResources(1020, $filters); // Производители $filters[50178] = "%COLUMN%=0"; // $ret4 = $model->getResources(1020, $filters); // Производители НЕ премиум $ret22 = $model->getResources(1027, null); //$params[5055]=163; //$params[5095][50109]='%COLUMN%=15214'; $params[5055] = 1618; $params[5095][5048] = '%COLUMN%=15371'; $params[50178] = 1218; $params[50186][1] = " f1"; // дополнительный класс $params[50186][2] = "find_input1"; // id для текстового поля //$params[50186][50185]="1"; //$ret5 = $controller->executeAction(2354,$params); $ret5 = $controller->executeAction(2354, $params); echo '<script language="JavaScript">' . $ret5[1] . '</script>'; //$params[50178]=""; /* echo $ret5[1]; $params[5055]=163; $params[5095][50109]='%COLUMN%=15214'; $params[50186][1]=" f1"; // дополнительный класс $params[50186][2]="find_input1"; // id для текстового поля $params[50186][50185]="1"; $ret5 = $controller->executeAction(2354,$params); */ //$params[5055]=163; //$params[5095][50109]='%COLUMN%=15215'; $params[5095][5048] = '%COLUMN%=15372'; $params[50186][1] = " f2"; // дополнительный класс $params[50186][2] = "find_input2"; // id для текстового поля $params[50186][50185] = "2"; $ret6 = $controller->executeAction(2354, $params); echo '<script language="JavaScript">' . $ret6[1] . '</script>'; //$params[5055]=163; //$params[5095][50109]='%COLUMN%=15216'; $params[5095][5048] = '%COLUMN%=15373'; $params[50186][1] = " f3"; // дополнительный класс $params[50186][2] = "find_input3"; // id для текстового поля //$params[50186][50185]="3"; $ret7 = $controller->executeAction(2354, $params); echo '<script language="JavaScript">' . $ret7[1] . '</script>'; require_once 'templates/analog_base/analog_base.template.php'; }
function search($json) { function GetActive($id, $id2, $elem) { if ($id == $id2) { $rs = " active"; echo '<span style="display: none" id="window_popup_hidden" sel_elem=' . $elem . '></span>'; } else { $rs = ""; } return $rs; } $model = Model::getModel(); $type = $json[5055]; $filters[50100] = ParseForSearch($json[9092]); $results = $model->getResourcesGen($filters, $type); $i = 0; if (!empty($results)) { //$json[50104] foreach ($results as $result) { $rets = $rets . '<a href="#" class="list-group-item popup_find_list_item' . GetActive($result->items[5048], $json[5099], '"popup_list' . $i . '"') . '" onclick="popup_list_change_item(this)" targetId="' . $json[50104] . '" itemId="' . $result->items[5048] . '" val="' . $result->items[501] . '" id="popup_list' . $i . '">' . $result->items[501] . '<br />' . $result->items[50136] . '</a>'; $i++; } } else { $rets = '<span style="margin: 10px 0 0 10px;">Результатов нет</span>'; } return $rets; }
public function execute($params) { //echo 'ActionId='.$params[5058]; if (empty($params[50130])) { $formCounter = 1; } else { $formCounter = ++$params[50130]; } $filters = $params[5095]; $model = Model::getModel(); $action = $model->getAction($params[5058]); //5058.Действие $formId = $action->items[5065]; //echo 'FormId='.$formId; $columns = $model->getColumns2($formId); if ($params[50125] == 1) { $id = 1; } else { $id = null; } //50125.Флаг поискового запроса $table = $model->getDataSet($columns, $formId, $id, $filters); $userId = $_SESSION['id']; if (empty($userId)) { $userId = $params[50126][5079]; } //50126.Технические параметры, 5079.Пользователь echo '<script> if (data===undefined) data = {}; data[\'50130\']=' . $formCounter . '; if (data["' . $formCounter . '"]===undefined) data["' . $formCounter . '"]={}; if (data["50126"]===undefined) data["50126"]={}; data["50126"]["5079"]=' . $userId . '; </script>'; echo '<div class="table-responsive" id="data_container"><div id ="data_dataset_container"><table class="table table-striped table-hover table-condensed"><thead><tr>'; $colNum = 0; foreach ($table->cols as $col_value) { echo "<th>" . $col_value->name . $link[$col_value->alias] . "</th>"; $colNum++; } echo '</tr></thead><tbody>'; $lineNum = 0; if (!empty($table->data)) { foreach ($table->data as $val) { echo ' <script language ="JavaScript">data["' . $formCounter . '"]["' . $val[0]->id . '"]={};</script>'; //Переписать echo "<tr>"; //DELETE START $colNum = 0; foreach ($val as $col_value) { if ($action->items[5055] == 1010) { if ($table->cols[$colNum]->property == 5036) { $tempDate = $col_value->value; } if ($table->cols[$colNum]->property == 50203) { $tempState = $col_value->id; } } $colNum++; } //DELETE END $colNum = 0; foreach ($val as $col_value) { $params[5055] = $table->cols[$colNum]->domain; $params[5048] = $val[0]->id; //Переписать $params[50199] = $table->cols[$colNum]->res->items[50199][0]; $params[50200] = $table->cols[$colNum]->res->items[50200][0]; $params[50201] = $table->cols[$colNum]->res->items[50201][0]; $params[50130] = $formCounter; $viewer = $model->getViewer($table->cols[$colNum]->viewer, $params, $this); $tdbackground = "fd"; // строка для изменение фона в зависимости от даты if ($action->items[5055] == 1010) { $day_diff = ceil((strtotime($tempDate) - time()) / 86400); if ($day_diff == "-0") { $day_diff = 0; } if ($day_diff < 10 and ($tempState == "12020" or $tempState == "12015")) { $tdbackground = "background-color: rgb(245,112,118);"; } //$tdbackground=strtotime($tempDate); } echo '<td ddif="' . $day_diff . '" style="' . $tdbackground . '">' . $viewer->show($col_value, $params) . '</td>'; $this->printJavaScript($formCounter, $val[0]->id, $table->cols[$colNum]->property, 0, $col_value->value); //Переписать $colNum++; } if ($action->items[5055] == 1010) { //echo 'Заявка на заказ запчасти, Date='.$tempDate.', TempState='.$tempState.'<br>'; } echo "</tr>"; $lineNum++; } } echo '</tbody></table></div></div>'; $ret[3] = $table->numRow; //echo 'Param2:'.$params[50149]; if ($params[50149] == 1) { echo '<div id="data_container_footer">'; //echo 'NewValue=' . $params[50148]; if (!empty($params[50147])) { $pCount = ceil($ret[3] / $params[50147]); } if (!empty($params[50148])) { $currentPage = ceil($params[50148] / $params[50147]); } else { $currentPage = 1; } echo '<div id="light-pagination" class="pagination"></div>'; echo '</div>'; if (!empty($params[50147])) { echo '<script> function setPage(index){ data[\'' . $formCounter . '\'][\'50148\']=index*' . $params[50147] . '; data[\'' . $formCounter . '\'][\'50149\']=0; sendData2(data,data_dataset_container,false); } $("#light-pagination").pagination({ pages: ' . $pCount . ', hrefTextPrefix: "#", hrefTextSuffix: "", prevText: "<<", nextText: ">>", cssStyle: "light-theme", currentPage: ' . $currentPage . ' }); </script>'; } } return $ret; }
public function execute($params) { //$ret[0] = 'OpNotesController'; $model = Model::getModel(); $orders[5022] = 2; //5022.Дата создания //$filters = $params[5095]; $filters[5022] = '%COLUMN%>"' . date("Y-m-d H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 2, date("Y"))) . '"'; $filters[50114] = 1; $notes1 = $model->getResourcesOpt(1026, $filters, $orders); $filters2[50159] = '%COLUMN% = 0'; $filters2[50158] = '%COLUMN% = 1'; $filters2[50114] = 1; $notes2 = $model->getResourcesOpt(1026, $filters2, $orders); if (!empty($notes1) && !empty($notes2)) { $notes = array_merge($notes1, $notes2); } else { if (!empty($notes1)) { $notes = $notes1; } else { $notes = $notes2; } } $userId = $params[5079]; $ret[0] = '<div class="b-panel"> <p class="msg-header clearfix"> <span style="float: left;">Записки операторов</span> <span class="msg-add-open" style="float: right;" id="href-op-msg-add">Добавить<span class="glyphicon glyphicon-chevron-down" style="margin-left: 5px;" id="href-op-msg-add-arrow"></span></span> <span class="msg-add-open" style="float: right; margin-right: 20px;" id="href-op-filters-add">Фильтр<span class="glyphicon glyphicon-chevron-down" id="href-op-filters-add-arrow" style="margin-left: 5px;"></span></span> <span class="glyphicon glyphicon-remove tt" id="filter_clear_btn" style="display: none; cursor: pointer; float: right; font-size: 8pt; color: red; margin-right: 5px; margin-top: 3px;" data-toggle="tooltip" data-placement="left" title="Сбросить фильтр"></span> </p> <div id="op-msg-added-form" style="display: none;" up="false"> <textarea class="form-control" placeholder="Текст сообщения" style="width: 100%; max-width: 100%;" onchange="if (data[\'-2\']===undefined) data[\'-2\']={}; if (data[\'-2\'][\'0\']===undefined) data[\'-2\'][\'0\']={}; if (data[\'-2\'][\'0\'][\'5066\']===undefined) data[\'-2\'][\'0\'][\'5066\']={}; data[\'-2\'][\'0\'][\'5066\'][\'0\']=this.value;"></textarea> <div class="msg-footer"> <input type="checkbox" onchange="var flag; if (this.checked == true) flag = 1; else flag = 0; if (data[\'-2\']===undefined) data[\'-2\']={}; if (data[\'-2\'][\'0\']===undefined) data[\'-2\'][\'0\']={}; if (data[\'-2\'][\'0\'][\'50158\']===undefined) data[\'-2\'][\'0\'][\'50158\']={}; data[\'-2\'][\'0\'][\'50158\'][\'0\']=flag;"><span style="line-height: 10px;">Требует исполнения</span> <button type="button" class="btn btn-default btn-xs" style="float: right;" onclick="data[\'50126\']={}; data[\'50126\'][\'5079\']=' . $userId . ';data[\'5058\']=\'\'; data[\'50129\']=-2;data[\'50146\']=0; if (data[\'-2\']===undefined) data[\'-2\']={};data[\'-2\'][\'5058\']=2345;data[\'-2\'][\'5055\']=1026; if (data[\'-2\'][\'0\']===undefined) data[\'-2\'][\'0\']={}; if (data[\'-2\'][\'0\'][\'50150\']===undefined) data[\'-2\'][\'0\'][\'50150\']={}; data[\'-2\'][\'0\'][\'50150\'][\'0\']=' . $userId . '; sendForm2(-2,true,-3);">Отправить</button> </div> </div> <div class="op-msg-filters" id="op-msg-filters-form" style="display: none; z-index: 999;" up="false"> <input id="filter_input" type="text" class="form-control" style="width: 90%; margin: 10px auto;" onkeyup="checkFilterStatus();"/> <p style="width: 90%; margin: 5px auto;"> <input id="fch1" type="checkbox" checked="checked" onclick="checkFilterStatus();"> В обработке</input><br /> <input id="fch2" type="checkbox" checked="checked" onclick="checkFilterStatus();"> Исполненные</input><br /> <input id="fch3" type="checkbox" checked="checked" onclick="checkFilterStatus();"> Отмененные</input><br /> </p> </div><div id="op_view_form">'; if (!empty($notes)) { foreach ($notes as $note) { $noteId = $note->items[5048][0]; if (!empty($note->items[50150][0])) { $user = $model->getResourceOpt($note->items[50150][0], 102); } //50150.Отправитель сообщения, 102.Сотрудник if ($note->items[5014][0] != "") { $perf_user = $model->getResourceOpt($note->items[5014][0], 102); } //echo $note->items[5048] .",".$note->items[5066]. ",".$note->items[50150]. ",".$note->items[5022]. ",".$note->items[50158]. ",".$note->items[50159]. ",".$note->items[5014]. ",".$note->items[50160].'<BR>'; $frm_date = date("d.m, H:i", strtotime($note->items[5022][0])); $inc_flag = ''; // Если стоит флаг исполнения - выводим статус if ($note->items[50158][0] != 0) { $inc_flag = '<div class="btn-group" style="float: right; margin-top: 3px"> <button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown">Ожидает исполнения <span class="caret"></span></button> <ul class="dropdown-menu" role="menu"> <li><a href="#" onclick="data[\'50126\']={}; data[\'50126\'][\'5079\']=' . $userId . ';data[\'50129\']=-2;data[\'50146\']=' . $noteId . '; data[\'-2\']={};data[\'-2\'][\'5065\']=15395;data[\'-2\'][\'5055\']=1026;data[\'-2\'][\'5058\']=2334;data[\'-2\'][\'' . $noteId . '\']={};data[\'-2\'][\'' . $noteId . '\'][\'50159\']={};data[\'-2\'][\'' . $noteId . '\'][\'50159\'][\'0\']=1;data[\'-2\'][\'' . $noteId . '\'][\'5014\']={};data[\'-2\'][\'' . $noteId . '\'][\'5014\'][\'0\']=' . $userId . ';data[\'-2\'][\'' . $noteId . '\'][\'50160\']={};data[\'-2\'][\'' . $noteId . '\'][\'50160\'][\'0\']=\'' . date("Y-m-d H:i:s") . '\';data[\'-2\'][\'' . $noteId . '\'][\'5048\']={};data[\'-2\'][\'' . $noteId . '\'][\'5048\'][\'0\']=' . $noteId . ';sendForm2(-2,true,-3);">Исполнить</a></li> <li><a href="#" onclick="data[\'50126\']={}; data[\'50126\'][\'5079\']=' . $userId . ';data[\'50129\']=-2;data[\'50146\']=' . $noteId . '; data[\'-2\']={};data[\'-2\'][\'5065\']=15395;data[\'-2\'][\'5055\']=1026;data[\'-2\'][\'5058\']=2334;data[\'-2\'][\'' . $noteId . '\']={};data[\'-2\'][\'' . $noteId . '\'][\'50159\']={};data[\'-2\'][\'' . $noteId . '\'][\'50159\'][\'0\']=2;data[\'-2\'][\'' . $noteId . '\'][\'5014\']={};data[\'-2\'][\'' . $noteId . '\'][\'5014\'][\'0\']=' . $userId . ';data[\'-2\'][\'' . $noteId . '\'][\'50160\']={};data[\'-2\'][\'' . $noteId . '\'][\'50160\'][\'0\']=\'' . date("Y-m-d H:i:s") . '\';data[\'-2\'][\'' . $noteId . '\'][\'5048\']={};data[\'-2\'][\'' . $noteId . '\'][\'5048\'][\'0\']=' . $noteId . ';sendForm2(-2,true,-3);">Отменить</a></li> </ul> </div>'; if ($note->items[50159][0] == 1) { $inc_flag = '<span class="label label-success cancelll" style="float: right; margin-top: 3px; color: black">Исполнено: ' . $perf_user->items[508][0] . ' ' . $perf_user->items[509][0] . '</span>'; } if ($note->items[50159][0] == 2) { $inc_flag = '<span class="label label-warning cancelll" style="float: right; margin-top: 3px; color: black">Отменено</span>'; } } $ret[0] = $ret[0] . '<div class="panel panel-info msg-main"> <div class="panel-heading msg-panel clearfix"> <h3 class="panel-title" style="float: left;">' . $user->items[508][0] . ' ' . $user->items[509][0] . '</h3> <span class="glyphicon glyphicon-info-sign inf" style="color: green; float: right;"></span> <span class="glyphicon glyphicon-tint inf" style="color: black; float: right;"></span> </div> <div class="panel-body msg-body">' . $note->items[5066][0] . '</div> </div> <div class="msg-footer"> <span style="font-size: 8pt;">' . $frm_date . '</span>' . $inc_flag . '</div>'; } } $ret[0] = $ret[0] . '</div></div>'; $ret[1] = 'data[\'5058\']=\'\'; data[\'-3\']={}; data[\'-3\'][\'5058\']=2352; data[\'-3\'][\'50181\']=\'#op_notes_result\'; $(".tt").tooltip(); function checkFilterStatus(){ var res = false; if ($("#filter_input").val() != "") res=true; if (!$("#fch1").prop("checked")) res=true; if (!$("#fch2").prop("checked")) res=true; if (!$("#fch3").prop("checked")) res=true; if (!res) $("#filter_clear_btn").css("display", "none"); else $("#filter_clear_btn").css("display", "inline"); } $("#filter_clear_btn").click(function(){ $("#filter_input").val(""); $("#fch1").prop("checked", true); $("#fch2").prop("checked", true); $("#fch3").prop("checked", true); $("#filter_clear_btn").css("display", "none"); }); $("#href-op-msg-add").click(function(){ if ($("#op-msg-added-form").attr("up")=="false"){ $("#op-msg-added-form").slideDown(); $("#op-msg-added-form").attr("up", "true"); $("#href-op-msg-add-arrow").removeClass(); $("#href-op-msg-add-arrow").addClass("glyphicon glyphicon-chevron-up"); } else { $("#op-msg-added-form").slideUp(); $("#op-msg-added-form").attr("up", "false"); $("#href-op-msg-add-arrow").removeClass(); $("#href-op-msg-add-arrow").addClass("glyphicon glyphicon-chevron-down"); } }) $("#href-op-filters-add").click(function(){ if ($("#op-msg-filters-form").attr("up")=="false"){ $("#op-msg-filters-form").slideDown(function(){ $("#op-msg-filters-form").attr("up", "true"); }); $("#href-op-filters-add-arrow").removeClass(); $("#href-op-filters-add-arrow").addClass("glyphicon glyphicon-chevron-up"); } else { $("#op-msg-filters-form").slideUp(); $("#op-msg-filters-form").attr("up", "false"); $("#href-op-filters-add-arrow").removeClass(); $("#href-op-filters-add-arrow").addClass("glyphicon glyphicon-chevron-down"); } }) $("#op-msg-filters-form").mouseleave(function(){ if ($("#op-msg-filters-form").attr("up")=="true"){ $("#op-msg-filters-form").slideUp(); $("#op-msg-filters-form").attr("up", "false"); $("#href-op-filters-add-arrow").removeClass(); $("#href-op-filters-add-arrow").addClass("glyphicon glyphicon-chevron-down"); } })'; return $ret; }
<?php chdir('../'); require_once 'main.controller.php'; $controller = new Controller(); $params[5055] = 111; //5055.Домен $params[50178] = 1221; //50178.Отображатель $params[5095][5048] = '%COLUMN%=1154'; //5095.Фильтры $params[50186][5048] = 15032; $model = Model::getModel(); $model->user_id = 15011; $model->loadPermissions(); $ret = $controller->executeAction(2354, $params); echo $ret[0]; ?> <!--
private function __loadData($conditions, $deep) { $sql = $this->__createSQL($conditions, $deep); /* Execute the query to the datasource */ $results = Datasource::query($sql); /* Create models from the query results */ $dataPopulatedModels = array(); /* * Yes, there is overheader here, as the model -object used for querying * is actually not the one then being returned by the load() -call */ foreach ($results as $row) { $model = Model::getModel($this->modelCache->getModelSource()); foreach ($this->modelCache->getFields() as $field) { $model->{$field} = $row[$field]; $model->fields[] = $field; $model->originalValues[$field] = $row[$field]; } if ($deep) { /* * 1...N relationships */ if (is_array($this->hasMany)) { foreach ($this->hasMany as $key => $value) { $name = is_array($value) ? $key : $value; if (is_array($value)) { $model->{$name} = Model::getModel($name)->loadAll(array($value["field"] => $row[$this->modelCache->getPrimaryKey()])); } else { $model->{$name} = Model::getModel($name)->loadAll(array($this->modelName . "_id" => $row[$this->modelCache->getPrimaryKey()])); } } } /* * 1...1 relationships */ if (is_array($this->hasOne)) { foreach ($this->hasOne as $key => $value) { $name = is_array($value) ? $key : $value; if (is_array($value)) { $model->{$name} = Model::getModel($name)->load(array($value["field"] => $row[$this->modelCache->getPrimaryKey()])); } else { $model->{$name} = Model::getModel($name)->load(array($this->modelName . "_id" => $row[$this->modelCache->getPrimaryKey()])); } } } } $dataPopulatedModels[] = $model; } return $dataPopulatedModels; }