本文整理汇总了PHP中AdminHelper类的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper类的具体用法?PHP AdminHelper怎么用?PHP AdminHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AdminHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeValidate
public function beforeValidate()
{
if ($this->isNewRecord && $this->keyword === null) {
$this->keyword = AdminHelper::generateUrlStr($this->alias, $this, 'keyword');
}
return parent::beforeValidate();
}
示例2: session_footer
public static function session_footer()
{
if (array_key_exists("fc_mode", $_SESSION)) {
$mode = $_SESSION["fc_mode"];
if ($mode == AdminHelper::MODE_ADMIN) {
AdminHelper::admin_footer();
} elseif ($mode == AdminHelper::MODE_PREVIEW) {
AdminHelper::preview_footer();
}
}
}
示例3: checkLogin
function checkLogin()
{
if (isset($_POST['email_address']) && isset($_POST['password'])) {
$login_details = AdminHelper::doLogin($_POST['email_address'], $_POST['password']);
if ($login_details !== false) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例4: addHistoryLink
public static function addHistoryLink($link = false, $modelName = false, $ignoreRequestForModelName = false)
{
if (\Session::has('adminHistoryLinks')) {
$links = \Session::get('adminHistoryLinks');
} else {
$links = array();
}
if (!$link) {
$url = explode('?', $_SERVER["REQUEST_URI"]);
$link = array_shift($url) . Tools::getGets();
}
if (!$modelName) {
$modelName = \Request::segment(2);
}
$linkSegments = explode("/", $link);
$action = isset($linkSegments[3]) ? $linkSegments[3] : false;
$addLink = isset($linkSegments[4]) && $linkSegments[4] == "new" ? true : false;
$tempLinks = $links;
if (count($links)) {
$delete = false;
foreach ($links as $index => $cLink) {
// If ModelName and Action already exist in history, it means we're going back
// therefore delete all history links AFTER the current history link
// and replace current history with the newly modified one
if ($cLink['modelConfigName'] == $modelName && $cLink['action'] == $action) {
$delete = true;
// Skip this iteration because this is the link we're going back to
continue;
}
// Delete all links after the one we're going back to
if ($delete) {
unset($tempLinks[$index]);
}
}
if ($delete) {
\Session::put('adminHistoryLinks', $tempLinks);
// There is no need to insert the current link because it already exists
// so just return
return;
}
}
$modelConfig = AdminHelper::modelExists($modelName);
if ($ignoreRequestForModelName) {
$returnModelName = $modelConfig ? $modelConfig->hrName : $modelName;
} else {
$returnModelName = $modelConfig ? count(\Request::segments()) > 2 && \Request::segment(3) == 'edit' ? $modelConfig->hrName : $modelConfig->hrNamePlural : $modelName;
}
$links[] = array('link' => $link, 'action' => $action, 'addLink' => $addLink, 'modelConfigName' => $modelConfig ? $modelConfig->name : $modelName, 'modelName' => $returnModelName, 'modelIcon' => $modelConfig && $modelConfig->faIcon ? $modelConfig->faIcon : 'fa-circle');
\Session::put('adminHistoryLinks', $links);
}
示例5: beforeSave
/**
* Generate the filtered url string.
*/
public function beforeSave($event)
{
$owner = $this->getOwner();
$id = !$owner->isNewRecord ? $owner->primaryKey : null;
foreach (Yii::app()->languageManager->languages as $l => $lang) {
if ($l === Yii::app()->sourceLanguage) {
$suffix = '';
$language = null;
} else {
$suffix = '_' . $l;
$language = $l;
}
$owner->{$this->attribute . $suffix} = AdminHelper::generateUrlStr($owner->{$this->sourceAttribute . $suffix}, $owner, $this->attribute, $id, $language);
}
}
示例6: beforeSave
public function beforeSave()
{
$id = !$this->isNewRecord ? $this->primaryKey : null;
foreach (Yii::app()->languageManager->languages as $l => $lang) {
if ($l === Yii::app()->sourceLanguage) {
$suffix = '';
$language = null;
} else {
$suffix = '_' . $l;
$language = $l;
}
$this->{'title_url' . $suffix} = AdminHelper::generateUrlStr($this->{'title' . $suffix}, $this, 'title_url', $id, $language);
}
return parent::beforeSave();
}
示例7: getRealPath
/**
* Returns script filename by URL
*
* @param string $site Site ID.
* @param string $url URL.
* @return string|null
*/
public static function getRealPath($site, $url)
{
$docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
$url = str_replace('\\', '/', $url);
$url = \CHTTP::urnEncode($url);
$uri = new \Bitrix\Main\Web\Uri($url);
$path = \CHTTP::urnDecode($uri->getPath());
if (substr($path, -1, 1) == '/') {
$path .= 'index.php';
}
$file = new \Bitrix\Main\IO\File($docRoot . $path);
if ($file->isExists()) {
return substr($file->getPath(), strlen($docRoot));
}
if ($rewriteRules = AdminHelper::getRewriteRules($site)) {
$pathQuery = \CHTTP::urnDecode($uri->getPathQuery());
foreach ($rewriteRules as &$item) {
if (preg_match($item['CONDITION'], $pathQuery)) {
$url = empty($item['PATH']) && !empty($item['RULE']) ? preg_replace($item['CONDITION'], $item['RULE'], $pathQuery) : $item['PATH'];
$url = \CHTTP::urnEncode($url);
$uri = new \Bitrix\Main\Web\Uri($url);
$path = \CHTTP::urnDecode($uri->getPath());
$file = new \Bitrix\Main\IO\File($docRoot . $path);
if ($file->isExists()) {
$pathTmp = str_replace('.', '', strtolower(ltrim($path, '/\\')));
$pathTmp7 = substr($pathTmp, 0, 7);
if ($pathTmp7 == 'upload/' || $pathTmp7 == 'bitrix/') {
continue;
}
if ($file->getExtension() != 'php') {
continue;
}
return substr($file->getPath(), strlen($docRoot));
}
}
}
}
return null;
}
示例8: run
/**
* Generates the TabularInputWidget and the javascript that drives the blocs.
*/
public function run()
{
// Preparing variables.
$layouts = array();
$layoutSelect = array();
$afterAddItem = '';
$beforeAddItem = '';
$afterInit = '';
$sortableStart = '';
$sortableStop = '';
$beforeDeleteItem = '';
$afterDeleteItem = '';
foreach (Yii::app()->params['blocs'] as $bloc) {
$modelClassName = 'Bloc' . ucfirst($bloc);
$newBlocModel = new $modelClassName();
$newBlocModel->title_anchor = true;
$newBlocModel->title_page = true;
$layouts['application.components.blocs.' . $bloc . '.views.admin'] = $newBlocModel;
$layoutSelect['application.components.blocs.' . $bloc . '.views.admin'] = Yii::t('admin', 'bloc_' . $bloc);
$afterAddItem .= Yii::app()->cms->blocs[$bloc]->afterAddItem() . "\n";
$beforeAddItem .= Yii::app()->cms->blocs[$bloc]->beforeAddItem() . "\n";
$afterInit .= Yii::app()->cms->blocs[$bloc]->afterInit() . "\n";
$sortableStart .= Yii::app()->cms->blocs[$bloc]->sortableStart() . "\n";
$sortableStop .= Yii::app()->cms->blocs[$bloc]->sortableStop() . "\n";
$beforeDeleteItem .= Yii::app()->cms->blocs[$bloc]->beforeDeleteItem() . "\n";
$afterDeleteItem .= Yii::app()->cms->blocs[$bloc]->afterDeleteItem() . "\n";
}
$renderData = array();
foreach ($this->models as $key => $models) {
if ($key !== 0) {
$renderData[$key] = $models;
}
}
// Instanciating widget.
$this->widget('application.components.widgets.TabularInput.TabularInputWidget', array('id' => $this->id, 'form' => isset($this->form) ? $this->form : null, 'models' => $this->models[0], 'layoutExpression' => "'application.components.blocs.'.lcfirst(mb_substr(get_class(\$model), 4)).'.views.admin'", 'layout' => $layouts, 'layoutSelect' => $layoutSelect, 'itemTitleExpression' => "Yii::t('admin', \$model->tableName())", 'orderAttribute' => 'rank', 'nestedWidgets' => array('{formId}-{itemId}-blocDocumentDocumentForm', '{formId}-{itemId}-blocPeoplePeopleForm', '{formId}-{itemId}-blocCitationCitationForm', '{formId}-{itemId}-blocFeatureFeatureForm'), 'renderData' => $renderData, 'sortable' => array('start' => "js:function(event, ui){\n\t\t\t\t\t" . AdminHelper::tabularInputCkEditorSortableStart() . "\n\t\t\t\t\t" . $sortableStart . "\n\t\t\t\t}", 'stop' => "js:function(event, ui){\n\t\t\t\t\t" . AdminHelper::tabularInputCkEditorSortableStop() . "\n\t\t\t\t\t" . $sortableStop . "\n\t\t\t\t}"), 'beforeDeleteItem' => "function(id, itemId){\n\t\t\t\t" . AdminHelper::tabularInputCkEditorBeforeDeleteItem() . "\n\t\t\t\t" . $beforeDeleteItem . "\n\t\t\t}", 'afterDeleteItem' => "function(id, itemId){\n\t\t\t\t" . $afterDeleteItem . "\n\t\t\t}", 'beforeAddItem' => "function(id, itemId){\n\t\t\t\t" . $beforeAddItem . "\n\t\t\t}", 'afterAddItem' => "function(id, itemId){\n\t\t\t\t" . AdminHelper::tabularInputAfterAddItemDatetimePicker() . "\n\t\t\t\t" . $afterAddItem . "\n\t\t\t}", 'afterInit' => "function(id){\n\t\t\t\t" . $afterInit . "\n\t\t\t}"));
}
示例9: foreach
<div class="col-lg-6">
@foreach ($modelConfig->relatedModels as $relatedModel)
<?php
$displayModel = true;
if ($modelConfig->reverseConstrainingModels) {
foreach ($modelConfig->reverseConstrainingModels as $constraint) {
if (method_exists($object, $constraint) && $object->{$constraint}->count()) {
$displayModel = false;
break;
}
}
}
$method = $relatedModel->method;
$relatedModelConfig = AdminHelper::modelExists($relatedModel->name);
$gets = Tools::getGets(array($modelConfig->id => $object->id ? $object->id : "new_gtcms_entry"));
$configInParent = $object->relatedModelConfiguration($relatedModelConfig->name);
GtcmsPremium::setDisplayRelatedModelBasedOnModelKey($configInParent, $object, $displayModel);
?>
@if ($displayModel)
<div class="panel panel-default">
<div class="panel-body">
<?php
// --------------- EXCEPTIONS ----------------
$addObject = true;
?>
@if ($addObject)
<div class="indexTableHeader">
<a href="/admin/{{$relatedModelConfig->name}}/add{{$gets}}&addToParent=true" class="btn btn-primary btn-sm addRelatedObject">
<i class="fa fa-plus-circle"></i> {{$relatedModelConfig->hrName}}
示例10: attributeLabels
public function attributeLabels()
{
return AdminHelper::multilangLabels($this, array('id' => '#', 'title_anchor' => 'Inclure dans l’index de contenu', 'title_page' => 'Afficher le titre dans la page', 'title' => 'Titre du bloc', 'user_id' => 'Utilisateur', 'set_id' => 'Galerie', 'nbr_images' => 'Nombre d’images', 'show_as_carrousel' => 'Afficher en tant que carrousel'));
}
示例11: foreach
<?php
// parsing posted data:
if (isset($_POST['docampaignedit'])) {
// do the actual list add stuffs...
$edit_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'editcampaign', 'id' => $request_parameters[0], 'title' => $_POST['campaign_title'], 'description' => $_POST['campaign_description']));
if ($edit_response['status_uid'] == 'element_editcampaign_200') {
AdminHelper::formSuccess('Success. Edited.', '/');
} else {
AdminHelper::formFailure('Error. There was a problem editing your campaign.', '/');
}
}
$current_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getcampaign', 'id' => $request_parameters[0]));
$cash_admin->page_data['ui_title'] = 'Campaigns: Edit "' . $current_response['payload']['title'] . '"';
$current_campaign = $current_response['payload'];
if (is_array($current_campaign)) {
$cash_admin->page_data = array_merge($cash_admin->page_data, $current_campaign);
}
$cash_admin->page_data['form_state_action'] = 'docampaignedit';
$cash_admin->page_data['button_text'] = 'Save changes';
$elements_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getelementsforcampaign', 'id' => $request_parameters[0]));
if (is_array($elements_response['payload'])) {
foreach ($elements_response['payload'] as &$element) {
if ($element['modification_date'] == 0) {
$element['formatted_date'] = CASHSystem::formatTimeAgo($element['creation_date']);
} else {
$element['formatted_date'] = CASHSystem::formatTimeAgo($element['modification_date']);
}
}
$cash_admin->page_data['elements_for_campaign'] = new ArrayIterator($elements_response['payload']);
}
示例12: attributeLabels
public function attributeLabels()
{
return AdminHelper::multilangLabels($this, array('id' => 'ID', 'bloc_feature_id' => 'Bloc Feature', 'image' => 'Image reliée', 'title' => 'Titre de la caractéristique', 'description' => 'Détails de la caractéristique', 'rank' => 'Rank'));
}
示例13: array
<?php
// add unique page settings:
$page_title = 'Elements: Main';
$page_tips = 'This is where specific functionalities will be deployed, pages installed, and widgets set up. It is really the heart of the public-facing tools — the other tabs are more aimed at management, lightweight CRM, and fulfillment.';
$page_memu = array('Elements' => array('elements/add/' => array('Add Element', 'plus_alt'), 'elements/view/' => array('Your Elements', 'heart_fill')));
$element_page_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'mostactive', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
if ($element_page_request->response['status_code'] == 200) {
$page_data['element_mostactive'] = $element_page_request->response['payload'];
} else {
$page_data['element_mostactive'] = false;
}
$element_page_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'recentlyadded', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
if ($element_page_request->response['status_code'] == 200) {
$page_data['element_recentlyadded'] = $element_page_request->response['payload'];
} else {
$page_data['element_recentlyadded'] = false;
}
示例14: afterSave
/**
* Saving related Bloc entry.
*/
public function afterSave($event)
{
$owner = $this->getOwner();
if ($owner->isNewRecord) {
$contentBloc = new Bloc();
if (Yii::app()->languageManager->multilang) {
$contentBloc->multilang();
}
$contentBloc->parent_id = $owner->parent_id;
$contentBloc->bloc_type = mb_substr($owner->tableName(), 5);
$contentBloc->bloc_id = $owner->primaryKey;
} else {
if (Yii::app()->languageManager->multilang) {
$contentBloc = Bloc::model()->multilang()->findByAttributes(array('bloc_id' => $owner->primaryKey, 'bloc_type' => mb_substr($owner->tableName(), 5)));
} else {
$contentBloc = Bloc::model()->findByAttributes(array('bloc_id' => $owner->primaryKey, 'bloc_type' => mb_substr($owner->tableName(), 5)));
}
}
$contentBloc->rank = $owner->rank;
$contentBloc->title_anchor = $owner->title_anchor;
$contentBloc->title_page = $owner->title_page;
$contentBloc->unique_id = $owner->unique_id;
$contentBloc->last_modified = date('Y-m-d H:i:s');
foreach (Yii::app()->languageManager->languages as $l => $fullLanguage) {
if ($l === Yii::app()->sourceLanguage) {
$suffix = '';
} else {
$suffix = '_' . $l;
}
$contentBloc->{'title' . $suffix} = $owner->{'title' . $suffix};
if ($owner->isNewRecord) {
$contentBloc->{'title_url' . $suffix} = AdminHelper::generateUrlStr($owner->{'title' . $suffix}, $contentBloc, 'title_url', null, $l);
} else {
$contentBloc->{'title_url' . $suffix} = AdminHelper::generateUrlStr($owner->{'title' . $suffix}, $contentBloc, 'title_url', $contentBloc->id, $l);
}
}
$contentBloc->save(false);
}
示例15: header
<?php
if (!$request_parameters) {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
$page_request = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getlist', 'list_id' => $request_parameters[0]), 'getlist');
//var_dump($page_request);
if ($page_request['status_uid'] == 'people_getlist_200') {
$elements_data = AdminHelper::getElementsData();
$effective_user = AdminHelper::getPersistentData('cash_effective_user');
if ($page_request['payload']['user_id'] == $effective_user) {
if (isset($_POST['dodelete']) || isset($_GET['modalconfirm'])) {
$list_delete_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'deletelist', 'list_id' => $request_parameters[0]));
if ($list_delete_request->response['status_uid'] == 'people_deletelist_200') {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
}
$cash_admin->page_data['title'] = 'People: Delete “' . $page_request->response['payload']['name'] . '”';
} else {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
} else {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/delete/' . $request_parameters[0]);
}
$cash_admin->setPageContentTemplate('delete_confirm');