本文整理汇总了PHP中Admin::link方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::link方法的具体用法?PHP Admin::link怎么用?PHP Admin::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminViewCategoryLink
public static function adminViewCategoryLink($cat)
{
if ($cat->type == "Page")
return Admin::link($cat->title, 'pages/update', array('catPk'=>$cat->pk));
else
return Admin::link($cat->title, 'dataTypes/admin', array('catPk'=>$cat->pk));
}
示例2: actionDetails
public function actionDetails($pk)
{
$block = $this->loadModel($pk);
$res = '';
foreach($block->widgets as $widget)
$res .= $this->renderPartial('/widgets/item', array('model'=>$widget), true);
echo CHtml::tag('ul', array(), $res);
echo Admin::link('Добавить виджеты', 'blocks/addWidgets', array('blockPk'=>$block->pk), array('class'=>'add-widegts'));
}
示例3: display
public static function display()
{
if (!is_numeric($_GET['id'])) {
cc_redirect(Admin::link('users'));
}
if ($_POST['cc_form'] == 'edit-group') {
$id = $_GET['id'];
$previous = (array) unserialize(urldecode($_POST['previous']));
$group = $_POST['group'];
$permissions = (array) $_POST['permissions'];
$new = array_merge($previous, $permissions);
foreach ($new as $k => $v) {
if ($v == "1") {
$new[$k] = true;
}
if (!array_key_exists($k, $permissions)) {
$new[$k] = false;
}
}
if (DB::update('users', array('name', 'data'), array($group, serialize(filter('admin_edit_group_data', array('permissions' => $new)))), array('users_id = ?', $id))) {
$message = Message::success(__('admin', 'group-information-updated'));
} else {
$message = Message::error(__('admin', 'database-error'));
}
}
$p = Permissions::getAll();
$g = new Group((int) $_GET['id']);
$p_form = new Form('');
$p_form->setCC_Form('edit-group');
$p_form->startFieldset(__('admin', 'group-information'));
$p_form->addInput(__('admin', 'group-name'), 'text', 'group', $g->getName());
$p_form->endFieldset();
$p_form->addHTML(sprintf("<h3>%s</h3>", __('admin', 'permissions')));
$p_table = new Table('permissions');
$p_table->addHeader(array('Name', 'Allowed'));
foreach ($p as $k => $v) {
$previous[$v['name']] = $g->isAllowed($v['name']);
$p_table->addRow(array(__('permissions', $v['name']), sprintf('<input type="checkbox" name="permissions[%s]"%svalue="1"/>', $v['name'], $g->isAllowed($v['name']) ? ' checked="checked"' : '')));
}
$p_form->addHidden('previous', urlencode(serialize($previous)));
$p_form->addHTML($p_table->html());
$p_form->addSubmit('', 'save-permissions', __('admin', 'save-changes'));
return array(sprintf('%s: %s', __('admin', 'edit-group'), $g->getName()), $message . $p_form->html());
}
示例4: getSystemMenu
public function getSystemMenu()
{
$menu = array(
'categories' => array('text'=>Admin::link('Категории', 'categories/admin')),
'components' => array('text'=>Admin::link('Компоненты', 'manage/componentsGallery')),
'settings' => array('text'=>Admin::link('Настройки Сайта', 'settings/admin')),
/*array('text'=>Admin::link('Пользователи', 'users/admin')),
array(
'text'=>'Списки',
'children'=>array(
array('text'=>Admin::link('Проделанные работы', 'portfolioWorks/admin')),
array('text'=>Admin::link('Виды деятельности', 'portfolioWorkTypes/admin')),
array('text'=>Admin::link('Города', 'cities/admin')),
)
),*/
//'logout' => array('text'=> Users::link('Выход', 'logout'))
);
$res = Y::hooks()->cmsAdminGetSystemMenu($this, array('menu'=>$menu));
return $res['menu'];
}
示例5: display
public static function display()
{
$id = $_GET['id'];
if (!is_numeric($id)) {
$r = self::invalidIdError();
i18n::restore();
cc_redirect(Admin::link('content'));
return array('Error', $r);
}
$pageInfo = Database::select('content', '*', array('content_id = ?', $id));
$row = $pageInfo->fetch(PDO::FETCH_ASSOC);
if (!$row) {
$r = self::invalidIdError();
i18n::restore();
cc_redirect(Admin::link('content'));
return $r;
}
$row['settings'] = unserialize($row['settings']);
self::$row = $row;
return Content::nodeDisplay('edit_display', $row['type'], $row);
}
示例6: actionCreate
public function actionCreate()
{
if (isset($_POST['newWidgets'])) {
$widgets = array();
$transaction = Yii::app()->db->beginTransaction();
foreach ($_POST['newWidgets'] as $class) {
$model = TemplateWidget::model();
$model->class = $class;
$widgetName = $class.'Widget';
$model->settings = $widgetName::getDefaultSettings();
$widgets[] = $model;
}
//save all widgets in transaction
try {
foreach ($widgets as $model)
if (!$model->save())
throw new CException('Sorry, adding widgets proved unsuccessful. Try again');
$transaction->commit();
} catch(Exception $e) {
$transaction->rollBack();
Y::end(Admin::t($e->getMessage()));
}
//some output
$content = Admin::link('', 'widgets/see', array('pk'=>$model->pk), array('class'=>'widget-preview'));
$content.= Admin::link('', 'widgets/settings', array('pk'=>$model->pk), array('class'=>'widget-settings'));
$content.= CHtml::tag('div', array(), $model->alias);
$content.= Admin::link('x', 'widgets/delete', array('pk'=>$model->pk), array('class'=>'widget-delete'));
echo CHtml::tag('li', array('class'=>'widget'), $content);
} else {
//make list of widgets
$widgets = Y::resources()->registeredWidgets;
$list = CHtml::listData($widgets, 'pk', 'title');
$this->renderPartial("/widgets/widgetChangeForm", array('widgets'=>$list, 'action'=>Admin::url('widgets/create')), false, true);
}
}
示例7: display
public static function display()
{
if (array_key_exists('action', $_GET) && !empty($_GET['name'])) {
if ($_GET['action'] == 'disable') {
DB::update('plugins', array('active' => '0'), null, array('name = ?', $_GET['name']));
}
if ($_GET['action'] == 'enable') {
$smt = DB::select('plugins', '*', array('name = ?', $_GET['name']));
$row = $smt->fetch(PDO::FETCH_ASSOC);
if ($row === false) {
DB::insert('plugins', array('name' => $_GET['name'], 'info' => serialize(array()), 'active' => '1'));
} else {
DB::update('plugins', array('active' => '1'), null, array('name = ?', $_GET['name']));
}
}
cc_redirect(Admin::link('plugins'));
}
$arr = array();
$r = sprintf("\n\t\t\t<table id='plugins-table' cellspacing='0' cellpadding='0'>\n\t\t\t\t<thead>\n\t\t\t\t\t<th>%s</th><th>%s</th><th class='en-di-col'> </th>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>", __('admin', 'plugin-name'), __('admin', 'plugin-desc'));
foreach (Plugins::getBootedInfo() as $val) {
$arr[] = array(array($val['name'], $val['dir'], $val['name'], $val['desc'], $val['author'], $val['version']), true);
$arr2[] = $val['dir'];
}
foreach (Plugins::getActiveInfo() as $val) {
if (array_search($val['dir'], $arr2) === false) {
$arr[] = array(array($val['name'], $val['dir'], $val['name'], $val['desc'], $val['author'], $val['version']), false);
}
}
usort($arr, 'PluginAdminPage::pluginSort');
foreach ($arr as $val) {
if ($val[1] == true) {
$r .= sprintf("<tr class='enabled'><td>%s %s<span class='byline'>by %s</span></td><td>%s</td><td>%s (<a href='%s'>%s</a>)</td></tr>", $val[0][2], $val[0][5], $val[0][4], $val[0][3], __('admin', 'currently-enabled'), Admin::link('plugins', array('action' => 'disable', 'name' => $val[0][1])), __('admin', 'disable'));
} else {
$r .= sprintf("<tr class='disabled'><td>%s %s<span class='byline'>by %s</span></td><td>%s</td><td>%s (<a href='%s'>%s</a>)</td></tr>", $val[0][2], $val[0][5], $val[0][4], $val[0][3], __('admin', 'currently-disabled'), Admin::link('plugins', array('action' => 'enable', 'name' => $val[0][1])), __('admin', 'enable'));
}
}
$r .= "</tbody></table>";
return array(__('admin', 'plugins'), $r);
}
示例8: display
public static function display()
{
$type = $_GET['type'];
$types = Content::contentTypes();
if (array_key_exists($type, $types) === false && array_key_exists($_POST['type'], $types) === false) {
$opt_list = array();
foreach ($types as $single_type => $class) {
$opt_list[$single_type] = call_user_func($class . '::name');
}
$form = new Form('self', 'post', 'add_node_1');
$form->addSelectList(__('admin', 'content-type'), 'type', $opt_list, true, 'page');
$form->addSubmit('', 'continue', __('admin', 'continue'));
return array(__('admin', 'add-page'), $form->endAndGetHTML());
}
if (!$type && $_POST['type']) {
if (array_key_exists('continue', $_POST)) {
cc_redirect(Admin::link($_GET['page'], array('type' => $_POST['type'])));
} else {
return;
}
}
AdminSidebar::registerForPage('content/create-page', 'EditPage::fileUploadBlock');
return Content::nodeDisplay('create_display', $type, array());
}
示例9: createContent
public static function createContent()
{
return sprintf("<a href='%s' class='action'>%s%s</a>", Admin::link('content/create-page'), icon('page_add'), __('admin', 'add-page'));
}
示例10: create_display
public static function create_display()
{
i18n::set('admin');
if ($_POST['cc_form'] == 'create_page') {
plugin('admin_create_post_pre_proccessing');
$id = $_GET['id'];
$title = filter('admin_create_post_title', self::get('title'));
$content = filter('admin_create_post_content', self::get('content_area'));
$last_modified = filter('admin_create_post_last_modified', time());
$settings = filter('admin_create_post_settings', self::get('settings'));
$weight = filter('admin_create_post_weight', self::get('weight'));
$menutitle = filter('admin_create_post_menutitle', self::get('menutitle'));
$parent_id = filter('admin_create_post_parent_id', self::get('parent_id'));
$slug = filter('admin_create_post_slug', self::get('slug'));
if (empty($menutitle) || empty($slug)) {
$message = Message::error(__('blank-error'));
plugin('admin_create_post_blank_error');
} else {
plugin('admin_create_post_post_proccessing');
$values = array('title' => $title, 'content' => $content, 'settings' => unserialize($settings), 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
$values = filter('admin_create_post_posted_values', $values);
$values['settings'] = serialize($values['settings']);
$res = Content::createNode($_GET['type'], $values);
if ($res) {
$message = Message::success(sprintf(__('page-creation-successful') . ' (<a href="%s">%s</a>)', Admin::link('content'), __('view-all-pages')));
} else {
$message = Message::error(__('page-creation-failed'));
}
}
//Hooks::bind('post_edit_page', 'EditPage::handlePost');
}
$r = $message;
$themeList = array_subkeys(Themes::getThemeList(), 'name');
$themeList['-1'] = 'Default Theme';
ksort($themeList);
$form = new Form('self', 'post', 'create_page');
$form->addHidden('settings', 'a:0:{}');
$form->startFieldset(__('page-info'), array('id' => 'page_info_f'));
$form->addInput(__('page-title'), 'text', 'title', self::get('title'), array('class' => 'large'));
$form->addHidden('content_type', self::get('type'));
$form->addSelectList(__('theme-override'), 'theme', $themeList);
$form->addSelectList(__('parent'), 'parent_id', self::buildParentOptions(), true, $_POST['parent_id'] ? $_POST['parent_id'] : '0');
$form->endFieldset();
plugin('admin_create_custom_fields', array(&$form));
$form->startFieldset(__('menu-settings'), array('id' => 'menu_settings_f'));
$form->addInput(__('menu-title'), 'text', 'menutitle', self::get('menutitle'));
$form->addInput(__('slug'), 'text', 'slug', self::get('slug'));
$form->addInput(__('weight'), 'text', 'weight', $_POST['weight'] ? $_POST['weight'] : '0');
$form->endFieldset();
plugin('admin_create_custom_fields2', array(&$form));
$form->startFieldset(__('content'));
$content = self::get('content_area');
$form->addEditor('<p></p>', 'content_area', empty($content) ? "<p></p>" : $content);
$form->endFieldset();
plugin('admin_create_custom_fields3', array(&$form));
$form->addSubmit('', 'save', __('save'));
i18n::restore();
return array(__('admin', 'add-page'), $r . $form->endAndGetHTML());
}
示例11: create_display
public static function create_display()
{
i18n::set('external-link-nodetype');
$message = "";
if ($_POST['cc_form'] == 'create_external_link') {
$id = $_GET['id'];
$weight = self::get('weight');
$menutitle = self::get('menutitle');
$parent_id = self::get('parent_id');
$slug = self::get('slug');
if (empty($url) || empty($text)) {
$message = Message::error(__('blank-error'));
} else {
if (empty($weight)) {
$weight = '0';
}
$values = array('title' => '', 'content' => '', 'settings' => 'a:0:{}', 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
$res = Content::createNode($_GET['type'], $values);
if ($res) {
$message = Message::success(sprintf(__('link-creation-successful') . ' (<a href="%s">%s</a>)', Admin::link('content'), __('admin', 'view-all-pages')));
} else {
$message = Message::error(__('link-creation-failed'));
}
}
}
$r = $message;
$form = new Form('self', 'post', 'create_external_link');
$form->addInput(__('url'), 'text', 'slug', self::get('slug'));
$form->addInput(__('display-text'), 'text', 'menutitle', self::get('menutitle'));
$form->addSelectList(__('parent'), 'parent_id', PageNode::buildParentOptions(), true, $_POST['parent_id'] ? $_POST['parent_id'] : '0');
$form->addInput(__('weight'), 'text', 'weight', self::get('weight'));
$form->addSubmit('', 'create', 'Create');
i18n::restore();
return array(__('external-link-nodetype', 'create-external-link'), $form->endAndGetHTML());
}
示例12: getSettingsLink
public function getSettingsLink($htmlOptions = array())
{
return Admin::link('', 'blocks/settings', array('pk'=>$this->pk), $htmlOptions);
}
示例13: display
public static function display()
{
$id = $_GET['id'];
if (!is_numeric($id)) {
i18n::restore();
cc_redirect(Admin::link('users'));
return 'redirected.';
}
$messages = "";
if ($_POST['cc_form'] === 'edit-user') {
$username = $_POST['name'];
$password = $_POST['password'];
$cpassword = $_POST['confirm-password'];
$group = $_POST['group'];
if ($password != $cpassword) {
$messages .= Message::error(__('admin', 'passwords-dont-match'));
} else {
$result = Database::select('users', '*', array('users_id = ?', $id));
$row = $result->fetch(PDO::FETCH_ASSOC);
$result = Database::select('users', '*', array('name = ?', $username));
if (!empty($result)) {
$userRow = $result->fetch(PDO::FETCH_ASSOC);
} else {
$result = false;
}
if ($result && $userRow['name'] == $username && $id != $userRow['id']) {
$messages .= Message::error(__('admin', 'username-in-use'));
} else {
if (!empty($password) && !empty($cpassword) && $password == $cpassword) {
$hash = hash('whirlpool', $password);
} else {
$hash = $row['value'];
}
$data = unserialize($row['data']);
$result = Database::update('users', array('name' => filter('admin_edit_user_username', $username), 'value' => $hash, 'type' => 'user', 'group' => filter('admin_edit_group', $group), 'data' => serialize(filter('admin_edit_user_data', $data))), null, array('id = ?', $id));
if ($result === 1) {
$messages .= Message::success(__('admin', 'user-updated'));
}
}
}
}
$result = Database::select('users', '*', array('users_id = ?', $id));
if (empty($result)) {
i18n::restore();
cc_redirect(Admin::link('users'));
}
self::$row = $result->fetch(PDO::FETCH_ASSOC);
$form = new Form('self', 'post', 'edit-user');
$groups = Users::allGroups();
foreach ($groups as $key => $value) {
$groups[$value->getId()] = $value->getName();
}
$form->startFieldset(__("admin", 'user-information'));
$form->addInput(__('admin', 'username'), 'text', 'name', self::get('name'));
$form->addInput(__('admin', 'password'), 'password', 'password');
$form->addInput(__('admin', 'confirm-password'), 'password', 'confirm-password');
$form->addSelectList(__('admin', 'group'), 'group', $groups, true, self::get('group'));
plugin('admin_edit_user_custom_fields', array(&$form));
$form->addSubmit('', 'edit-user', __('admin', 'edit-user'));
$form->endFieldset();
plugin('admin_edit_user_custom_fieldset', array(&$form));
$form = $form->endAndGetHTML();
return array(sprintf("%s: %s", __('admin', 'edit-user'), self::get('name')), $messages . $form);
}
示例14: viewAll
public static function viewAll()
{
return sprintf("<a href='%s' class='action'>%s%s</a>", Admin::link('users'), icon('group'), __('admin', 'view-all-users-and-groups'));
}
示例15: getDetailsLink
public function getDetailsLink($htmlOptions = array(), $ajaxOptions = null)
{
$title = isset($this->settings['title']) ? $this->settings['title'] : $this->title;
$url = 'widgets/details';
$params = array('pk'=>$this->pk);
if ($ajaxOptions === null) {
return Admin::link($title, $url, $params, $htmlOptions);
} else {
// Y::dump($ajaxOptions);
return Admin::ajaxLink($title, $url, $params, $ajaxOptions, $htmlOptions);
}
}