public static function SetTimeZoneIfNeed($timezoneIdentifier) { if (SystemUtils::GetPHPMinorVersion() >= 3) { if (StringUtils::IsNullOrEmpty(ini_get('date.timezone'))) { date_default_timezone_set($timezoneIdentifier); } } }
private function _uploadMobcentAudio($res, $attachment) { $savePath = $this->_getSavePath('audio'); if (!empty($savePath)) { $urlFileName = $this->_getPathFileName('audio', $attachment['name']); $fileName = $savePath . '/' . $urlFileName['file']; if (FileUtils::saveFile($fileName, $attachment['data']) != false) { // amr 转 mp3 $ffmpegCommand = Yii::app()->params['mobcent']['forum']['ffmpegCommand']; if (FileUtils::getFileExtension($fileName, 'mp3') == 'amr' && !empty($ffmpegCommand)) { $tempFileName = $fileName; $fileName .= '.mobcent.mp3'; $ffmpegCommand .= " -i {$tempFileName} {$fileName}"; SystemUtils::execInBackground($ffmpegCommand); } $res['urlName'] = $this->_getUrlFileName($urlFileName['path'], basename($fileName)); $res['id'] = 0; } } return $res; }
/** * @param Renderer $renderer * @return void */ public function Render(Renderer $renderer) { $params = ArrayWrapper::createGetWrapper(); $term = $params->isValueSet('term') ? $params->getValue('term') : ''; if ($params->isValueSet('term')) { $this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . $term . '%', 'ILIKE', true)); } if ($params->isValueSet('id')) { $this->dataset->AddFieldFilter($this->idField, FieldFilter::Equals($params->getValue('id'))); } if ($this->itemCount > 0) { $this->dataset->SetUpLimit(0); $this->dataset->SetLimit($this->itemCount); } $this->dataset->Open(); $result = array(); $highLightCallback = Delegate::CreateFromMethod($this, 'ApplyHighlight')->Bind(array(Argument::$Arg3 => $this->valueField, Argument::$Arg4 => $term)); while ($this->dataset->Next()) { $result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "label" => $highLightCallback->Call($this->dataset->GetFieldValueByName($this->valueField), $this->valueField), "value" => $this->dataset->GetFieldValueByName($this->valueField)); } echo SystemUtils::ToJSON($result); $this->dataset->Close(); }
<?php // define('SHOW_VARIABLES', 1); // define('DEBUG_LEVEL', 1); // error_reporting(E_ALL ^ E_NOTICE); // ini_set('display_errors', 'On'); set_include_path('.' . PATH_SEPARATOR . get_include_path()); include_once dirname(__FILE__) . '/' . 'components/utils/system_utils.php'; // SystemUtils::DisableMagicQuotesRuntime(); SystemUtils::SetTimeZoneIfNeed('America/Tegucigalpa'); function GetGlobalConnectionOptions() { return array('username' => 'ge', 'password' => 'ge', 'database' => 'MATCH'); } function HasAdminPage() { return false; } function GetPageGroups() { $result = array('Default'); return $result; } function GetPageInfos() { $result = array(); $result[] = array('caption' => 'BEBEDOR', 'short_caption' => 'BEBEDOR', 'filename' => 'GE.BEBEDOR.php', 'name' => 'GE.BEBEDOR', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'CATEGORIA INTERES', 'short_caption' => 'CATEGORIA INTERES', 'filename' => 'GE.CATEGORIA_INTERES.php', 'name' => 'GE.CATEGORIA_INTERES', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'CIUDAD', 'short_caption' => 'CIUDAD', 'filename' => 'GE.CIUDAD.php', 'name' => 'GE.CIUDAD', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'COLOR OJOS', 'short_caption' => 'COLOR OJOS', 'filename' => 'GE.COLOR_OJOS.php', 'name' => 'GE.COLOR_OJOS', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Webreports', 'short_caption' => 'Webreports', 'filename' => 'GE.webreports.php', 'name' => 'GE.webreports', 'group_name' => 'Default', 'add_separator' => false);
public final function GetViewData() { $result = array(); $fieldData = array(); foreach ($this->fields as $name => $data) { $fieldData[] = array('Name' => $name, 'Caption' => $data['caption'], 'Type' => $this->FieldTypeToJSFieldType($data['type']), 'EditorClass' => $data['editorClass'] ? $data['editorClass'] : $this->GetEditorClassByType($data['type']), 'EditorOptions' => $data['editorOptions'] ? SystemUtils::ToJSON($data['editorOptions']) : '{}'); } $result['Fields'] = $fieldData; return $result; }
public function RenderVerticalGrid(VerticalGrid $grid) { $this->SetHTTPContentTypeByPage($grid->GetGrid()->GetPage()); if ($grid->GetState() == VerticalGridState::JSONResponse) { $this->result = SystemUtils::ToXML($grid->GetResponse()); } else { if ($grid->GetState() == VerticalGridState::DisplayGrid) { $hiddenValues = array(OPERATION_PARAMNAME => OPERATION_COMMIT); AddPrimaryKeyParametersToArray($hiddenValues, $grid->GetGrid()->GetDataset()->GetPrimaryKeyValues()); $customParams = array(); $this->DisplayTemplate($grid->GetGrid()->GetPage()->GetCustomTemplate(PagePart::VerticalGrid, PageMode::ModalEdit, 'edit/vertical_grid.tpl', $customParams), array('Grid' => $grid->GetGrid()->GetModalEditViewData($this)), array_merge($customParams, array('HiddenValues' => $hiddenValues))); } else { if ($grid->GetState() == VerticalGridState::DisplayInsertGrid) { $hiddenValues = array(OPERATION_PARAMNAME => OPERATION_COMMIT); $customParams = array(); $this->DisplayTemplate($grid->GetGrid()->GetPage()->GetCustomTemplate(PagePart::VerticalGrid, PageMode::ModalInsert, 'insert/vertical_grid.tpl', $customParams), array('Grid' => $grid->GetGrid()->GetModalInsertViewData($this)), array_merge($customParams, array('HiddenValues' => $hiddenValues))); } else { if ($grid->GetState() == VerticalGridState::DisplayCopyGrid) { $hiddenValues = array(OPERATION_PARAMNAME => OPERATION_COMMIT); $customParams = array(); $this->DisplayTemplate($grid->GetGrid()->GetPage()->GetCustomTemplate(PagePart::VerticalGrid, PageMode::ModalInsert, 'insert/vertical_grid.tpl', $customParams), array('Grid' => $grid->GetGrid()->GetModalInsertViewData($this)), array_merge($customParams, array('HiddenValues' => $hiddenValues))); } } } } }
public function Render(Renderer $renderer) { $result = array(); $this->dataset->AddFieldFilter($this->captionFieldName, FieldFilter::Contains($this->arrayWrapper->GetValue(self::SearchTermParamName))); if (!StringUtils::IsNullOrEmpty($this->parentIdFieldName) && $this->arrayWrapper->IsValueSet(self::ParentParamName)) { $this->dataset->AddFieldFilter($this->parentIdFieldName, FieldFilter::Equals($this->arrayWrapper->GetValue(self::ParentParamName))); } $this->dataset->Open(); $valueCount = 0; while ($this->dataset->Next()) { $result[] = array('id' => $this->dataset->GetFieldValueByName($this->idFieldName), 'value' => $this->dataset->GetFieldValueByName($this->captionFieldName)); if (++$valueCount >= 20) { break; } } $this->dataset->Close(); echo SystemUtils::ToJSON($result); }
private function GetHiddenValuesJson() { return SystemUtils::ToJSON($this->GetHiddenValues()); }
<?php // define('SHOW_VARIABLES', 1); // define('DEBUG_LEVEL', 1); // error_reporting(E_ALL ^ E_NOTICE); // ini_set('display_errors', 'On'); set_include_path('.' . PATH_SEPARATOR . get_include_path()); include_once dirname(__FILE__) . '/' . 'components/utils/system_utils.php'; // SystemUtils::DisableMagicQuotesRuntime(); SystemUtils::SetTimeZoneIfNeed('America/Los_Angeles'); function GetGlobalConnectionOptions() { return array('server' => '192.168.1.25', 'port' => '3306', 'username' => 'root', 'password' => 'root', 'database' => 'WP20_OUT'); } function HasAdminPage() { return true; } function GetPageGroups() { $result = array('Default'); return $result; } function GetPageInfos() { $result = array(); $result[] = array('caption' => 'Dashboard', 'short_caption' => 'Dashboard', 'filename' => 'Dashboard.php', 'name' => 'Dashboard', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Project Type', 'short_caption' => 'Project Type', 'filename' => 'program.php', 'name' => 'program', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'View all Projects', 'short_caption' => 'Projects', 'filename' => 'project.php', 'name' => 'project', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Tasks - Time Tracking', 'short_caption' => 'Tasks - Time Tracking', 'filename' => 'task.php', 'name' => 'task', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Hours per Project', 'short_caption' => 'Hours per project', 'filename' => 'Hours per project by user.php', 'name' => 'Hours per Project by user', 'group_name' => 'Default', 'add_separator' => false);
/** * @param array $parameters * @return string */ public function HandleRequest($parameters) { try { $result = $this->RouteRequest($parameters); $status = 'OK'; } catch (Exception $e) { $result = $e->getMessage(); $status = 'error'; } return SystemUtils::ToJSON(array('status' => $status, 'result' => $result)); }
/** * @param Renderer $renderer * @return void */ public function Render(Renderer $renderer) { /** @var string $term */ $term = ''; if ($this->GetSuperGlobals()->IsGetValueSet('term')) { $term = $this->GetSuperGlobals()->GetGetValue('term'); } if (!StringUtils::IsNullOrEmpty($term)) { $this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . $term . '%', 'ILIKE', true)); } header('Content-Type: text/html; charset=utf-8'); $this->dataset->Open(); $result = array(); $valueCount = 0; $highLightCallback = Delegate::CreateFromMethod($this, 'ApplyHighlight')->Bind(array(Argument::$Arg3 => $this->valueField, Argument::$Arg4 => $term)); while ($this->dataset->Next()) { $result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "value" => StringUtils::IsNullOrEmpty($this->captionTemplate) ? $this->dataset->GetFieldValueByName($this->valueField) : DatasetUtils::FormatDatasetFieldsTemplate($this->dataset, $this->captionTemplate, $highLightCallback)); if ($valueCount >= 20) { break; } } echo SystemUtils::ToJSON($result); $this->dataset->Close(); }
<?php // define('SHOW_VARIABLES', 1); // define('DEBUG_LEVEL', 1); // error_reporting(E_ALL ^ E_NOTICE); // ini_set('display_errors', 'On'); set_include_path('.' . PATH_SEPARATOR . get_include_path()); include_once dirname(__FILE__) . '/' . 'components/utils/system_utils.php'; // SystemUtils::DisableMagicQuotesRuntime(); SystemUtils::SetTimeZoneIfNeed('Europe/Belgrade'); function GetGlobalConnectionOptions() { return array('server' => 'localhost', 'port' => '3306', 'username' => 'admin', 'password' => 'silvia', 'database' => 'atig'); } function HasAdminPage() { return true; } function GetPageGroups() { $result = array('Default'); return $result; } function GetPageInfos() { $result = array(); $result[] = array('caption' => 'Clienti', 'short_caption' => 'Clienti', 'filename' => 'clienti.php', 'name' => 'clienti', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Articoli', 'short_caption' => 'Articoli', 'filename' => 'articoli.php', 'name' => 'articoli', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Famiglie', 'short_caption' => 'Famiglie', 'filename' => 'famiglie.php', 'name' => 'famiglie', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Listino Voci', 'short_caption' => 'Listino Voci', 'filename' => 'listino_voci.php', 'name' => 'listino_voci', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Listino Articoli', 'short_caption' => 'Listino Articoli', 'filename' => 'listino_articoli.php', 'name' => 'listino_articoli', 'group_name' => 'Default', 'add_separator' => false);
<?php // define('SHOW_VARIABLES', 1); // define('DEBUG_LEVEL', 1); // error_reporting(E_ALL ^ E_NOTICE); // ini_set('display_errors', 'On'); set_include_path('.' . PATH_SEPARATOR . get_include_path()); include_once dirname(__FILE__) . '/' . 'components/utils/system_utils.php'; // SystemUtils::DisableMagicQuotesRuntime(); SystemUtils::SetTimeZoneIfNeed('Europe/Rome'); function GetGlobalConnectionOptions() { return array('server' => 'localhost', 'port' => '3306', 'username' => 'atig', 'password' => '20152015', 'database' => 'S01225_erikroncalli'); } function HasAdminPage() { return true; } function GetPageGroups() { $result = array('Default'); return $result; } function GetPageInfos() { $result = array(); $result[] = array('caption' => 'Clienti', 'short_caption' => 'Clienti', 'filename' => 'clienti.php', 'name' => 'clienti', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Articoli', 'short_caption' => 'Articoli', 'filename' => 'articoli.php', 'name' => 'articoli', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Famiglie', 'short_caption' => 'Famiglie', 'filename' => 'famiglie.php', 'name' => 'famiglie', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Listino Voci', 'short_caption' => 'Listino Voci', 'filename' => 'listino_voci.php', 'name' => 'listino_voci', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Listino Articoli', 'short_caption' => 'Listino Articoli', 'filename' => 'listino_articoli.php', 'name' => 'listino_articoli', 'group_name' => 'Default', 'add_separator' => false);
<?php // define('SHOW_VARIABLES', 1); // define('DEBUG_LEVEL', 1); // error_reporting(E_ALL ^ E_NOTICE); // ini_set('display_errors', 'On'); set_include_path('.' . PATH_SEPARATOR . get_include_path()); include_once dirname(__FILE__) . '/' . 'components/utils/system_utils.php'; // SystemUtils::DisableMagicQuotesRuntime(); SystemUtils::SetTimeZoneIfNeed('America/New_York'); function GetGlobalConnectionOptions() { return array('server' => 'SERVER', 'username' => 'USER', 'password' => 'PASS', 'database' => 'DATABASE'); } function HasAdminPage() { return false; } function GetPageGroups() { $result = array('Default'); return $result; } function GetPageInfos() { $result = array(); $result[] = array('caption' => 'Base de Datos', 'short_caption' => '', 'filename' => 'Base de Datos.php', 'name' => 'dbo.BaseDatos', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Detalle Objetos', 'short_caption' => '', 'filename' => 'Detalle Objetos.php', 'name' => 'dbo.AlterLog', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Sesiones', 'short_caption' => '', 'filename' => 'Sesiones.php', 'name' => 'dbo.procesosbd', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Volumen', 'short_caption' => '', 'filename' => 'Volumen.php', 'name' => 'dbo.TamanoBaseDatos', 'group_name' => 'Default', 'add_separator' => false); $result[] = array('caption' => 'Procesos', 'short_caption' => '', 'filename' => 'Procesos.php', 'name' => 'dbo.procesos', 'group_name' => 'Default', 'add_separator' => false);
public function Render(Renderer $renderer) { $result = array(); $this->dataset->AddFieldFilter($this->captionFieldName, FieldFilter::Contains($this->globals->GetGetValue(self::SearchTermParamName))); $highLightCallback = Delegate::CreateFromMethod($this, 'ApplyHighlight')->Bind(array(Argument::$Arg3 => $this->captionFieldName, Argument::$Arg4 => $this->globals->GetGetValue(self::SearchTermParamName))); if (!StringUtils::IsNullOrEmpty($this->parentIdFieldName) && $this->globals->IsGetValueSet(self::ParentParamName)) { $this->dataset->AddFieldFilter($this->parentIdFieldName, FieldFilter::Equals($this->globals->GetGetValue(self::ParentParamName))); } $this->dataset->Open(); while ($this->dataset->Next()) { $result[] = array('id' => $this->dataset->GetFieldValueByName($this->idFieldName), 'value' => $this->dataset->GetFieldValueByName($this->captionFieldName), 'label' => $highLightCallback->Call($this->dataset->GetFieldValueByName($this->captionFieldName), $this->captionFieldName)); } $this->dataset->Close(); echo SystemUtils::ToJSON($result); }
/** * @param Renderer $renderer * @return void */ public function Render(Renderer $renderer) { if (GetApplication()->GetSuperGlobals()->IsGetValueSet('term')) { $this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . GetApplication()->GetSuperGlobals()->GetGetValue('term') . '%', 'ILIKE', true)); } $this->dataset->Open(); $result = array(); $highLightCallback = Delegate::CreateFromMethod($this, 'ApplyHighlight')->Bind(array(Argument::$Arg3 => $this->valueField, Argument::$Arg4 => GetApplication()->GetSuperGlobals()->GetGetValue('term'))); $this->dataset->SetLimit(20); while ($this->dataset->Next()) { $result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "label" => $highLightCallback->Call($this->dataset->GetFieldValueByName($this->valueField), $this->valueField), "value" => $this->dataset->GetFieldValueByName($this->valueField)); } echo SystemUtils::ToJSON($result); $this->dataset->Close(); }
<?php // define('SHOW_VARIABLES', 1); // define('DEBUG_LEVEL', 1); // error_reporting(E_ALL ^ E_NOTICE); // ini_set('display_errors', 'On'); set_include_path('.' . PATH_SEPARATOR . get_include_path()); include_once dirname(__FILE__) . '/' . 'components/utils/system_utils.php'; // SystemUtils::DisableMagicQuotesRuntime(); SystemUtils::SetTimeZoneIfNeed('America/Argentina/Buenos_Aires'); function GetGlobalConnectionOptions() { return array( 'server' => '10.13.18.28', 'port' => '5432', 'username' => 'rcdto', 'password' => 'rcdto', 'database' => 'RCDTO' ); } function HasAdminPage() { return false;
public function GetAllUsersAsJson() { $usersDataset = $this->CreateUsersDataset(); $usersDataset->Open(); $users = array(); if ($this->allowGuest) { array_push($users, array('id' => -1, 'name' => 'guest', 'password' => '******', 'editable' => false)); } array_push($users, array('id' => 0, 'name' => 'PUBLIC (All users)', 'password' => '******', 'editable' => false)); while ($usersDataset->Next()) { $user = array('id' => $usersDataset->GetFieldValueByName($this->users_UserId), 'name' => $usersDataset->GetFieldValueByName($this->users_UserName), 'password' => '******', 'editable' => true); array_push($users, $user); } $usersDataset->Close(); return SystemUtils::ToJSON($users); }
function RenderGrid(Grid $grid) { $columnEditors = array(); $dataset = $grid->GetDataset(); if ($grid->GetErrorMessage() != '') { foreach ($grid->GetViewColumns() as $column) { $editor = $column->GetInsertOperationEditor(); if (isset($editor)) { $columnEditors[$column->GetName()]['Html'] = $this->Render($editor, false, true); $columnEditors[$column->GetName()]['Script'] = $this->Render($editor, true, false); } } $this->DisplayTemplate('inline_operations/grid_edit_error_response.tpl', array('ErrorCaption' => 'ErrorsDuringInsertProcess', 'ErrorMessage' => $grid->GetErrorMessage(), 'ColumnEditors' => $columnEditors), array()); return; } $cellClasses = array(); $rowStyleByColumns = $grid->GetRowStylesByColumn($grid->GetDataset()->GetFieldValues(), $cellClasses); $columns = array(); foreach ($grid->GetViewColumns() as $column) { $columnName = $dataset->IsLookupField($column->GetName()) ? $dataset->IsLookupFieldNameByDisplayFieldName($column->GetName()) : $column->GetName(); $columns[$column->GetName()]['Value'] = $grid->RenderColumn($this, $column); $columns[$column->GetName()]['AfterRowControl'] = $this->Render($column->GetAfterRowControl()); $columns[$column->GetName()]['Style'] = $rowStyleByColumns[$columnName]; } $primaryKeys = array(); if ($grid->GetAllowDeleteSelected()) { $primaryKeys = $grid->GetDataset()->GetPrimaryKeyValues(); } $actionsRowViewData = array(); foreach ($grid->getActions()->getOperations() as $operation) { $operationName = $dataset->IsLookupField($operation->GetName()) ? $dataset->IsLookupFieldNameByDisplayFieldName($operation->GetName()) : $operation->GetName(); $actionsRowViewData[$operationName] = array('OperationName' => $operationName, 'Data' => $operation->GetValue()); } $detailsViewData = $grid->GetDetailsViewData(); $this->DisplayTemplate('inline_operations/grid_insert_commit_response.tpl', array('encoding' => $grid->GetPage()->GetContentEncoding(), 'AllowDeleteSelected' => $grid->GetAllowDeleteSelected(), 'PrimaryKeys' => $primaryKeys, 'Columns' => $columns, 'Actions' => $actionsRowViewData, 'RecordUID' => Random::GetIntRandom(), 'HasDetails' => $grid->GetHasDetails(), 'Details' => array('Items' => $detailsViewData, 'JSON' => htmlspecialchars(SystemUtils::ToJSON($detailsViewData)))), array()); }
/** * @param Renderer $renderer * @return void */ public function Render(Renderer $renderer) { /** @var string $term */ $term = ''; if ($this->GetSuperGlobals()->IsGetValueSet('term')) { $term = $this->GetSuperGlobals()->GetGetValue('term'); } if (!StringUtils::IsNullOrEmpty($term)) { $this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . $term . '%', 'ILIKE', true)); } $id = null; if ($this->GetSuperGlobals()->IsGetValueSet('id')) { $id = $this->GetSuperGlobals()->GetGetValue('id'); } if (!StringUtils::IsNullOrEmpty($id)) { $this->dataset->AddFieldFilter($this->idField, FieldFilter::Equals($id)); } header('Content-Type: text/html; charset=utf-8'); $this->dataset->Open(); $result = array(); $valueCount = 0; while ($this->dataset->Next()) { $result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "value" => StringUtils::IsNullOrEmpty($this->captionTemplate) ? $this->dataset->GetFieldValueByName($this->valueField) : DatasetUtils::FormatDatasetFieldsTemplate($this->dataset, $this->captionTemplate)); if (++$valueCount >= 20) { break; } } echo SystemUtils::ToJSON($result); $this->dataset->Close(); }
public function AsJson() { return SystemUtils::ToJSON($this->GetRoot()->SaveToArray($this->contentEncoding)); }