本文整理汇总了PHP中Model::getModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::getModel方法的具体用法?PHP Model::getModel怎么用?PHP Model::getModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
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);
}
}
示例2: _init
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);
}
}
}
示例3: find
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;
}
示例4: execute
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;
}
示例5: func
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;
}
}
示例6: execute
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];
}
}
示例7: execute
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);
}
示例8: execute
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");
}
示例9: find
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.Просмотр сущностей класса
}
示例10: execute
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);
*/
}
示例11: execute
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';
}
示例12: execute
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';
}
示例13: loadPermissions
public function loadPermissions($userId){
$model = Model::getModel();
$model->user_id = $userId;
$model->loadPermissions();
}
示例14: execute
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';
}
示例15: search
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;
}