本文整理汇总了PHP中Router::buildLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::buildLink方法的具体用法?PHP Router::buildLink怎么用?PHP Router::buildLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::buildLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showPanelBox
function showPanelBox($app = "users", $title = "users", $badget = 12)
{
?>
<div class="col-lg-3 col-xs-4">
<div class="panel panel-info">
<div class="panel-heading">
<div class="row">
<div class="col-xs-6">
<i class="fa fa-comments fa-5x"></i>
</div>
<div class="col-xs-6 text-right">
<p class="announcement-heading">
<?php
if ($app != null) {
echo '<a href="' . Router::buildLink($app) . '">' . $title . '</a>';
} else {
echo $title;
}
?>
</p>
<p class="announcement-text"><?php
echo $badget;
?>
</p>
</div>
</div>
</div>
</div>
</div>
<?php
}
示例2: store
function store()
{
global $mainframe, $db, $user;
$post = $_POST;
$arr_team_table = Request::getVar('arr_team_table', null);
$arr_team_table = json_decode($arr_team_table, true);
$model = Tournament::getInstance();
global $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to change Tournament");
$this->redirect(Router::buildLink("gamesport", array('view' => 'tournament')));
}
$tourID = Request::getVar('tourID', 0);
$db = Yii::app()->db;
foreach ($arr_team_table as $table_num => $team_tables) {
if (count($team_tables)) {
$stt = 1;
foreach ($team_tables as $teamID => $team) {
if ($team == null) {
continue;
}
if ($team['ordering'] == null or $team['ordering'] == 0) {
$team['ordering'] = $stt;
}
$query = "UPDATE " . TBL_GS_TEAM_REGISTER_TOUR . " SET table_num = {$table_num}" . " ,ordering = " . $team['ordering'] . " ,mdate = now()" . " ,modified_by = {$user->id}" . " WHERE tourID = {$tourID} AND teamID = {$teamID}";
$command = $db->createCommand($query);
$command->execute();
$stt++;
}
}
}
return true;
}
示例3: storeItem
function storeItem()
{
global $mainframe, $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to modify module");
$this->redirect(Router::buildLink("cpanel"));
}
$cid = Request::getVar("id", 0);
$obj_module = YiiModule::getInstance();
$obj_row = $obj_module->loadItem($cid);
$obj_row->bind($_POST);
$menu_selected = Request::getVar('selection-menu-select', 'selected');
$obj_row->params = json_encode($_POST['params']);
$obj_row->menu = $menu_selected;
$obj_row->store();
if ($menu_selected == 'all') {
$query = "DELETE FROM " . TBL_MODULE_MENUITEM_REF . " WHERE moduleID = {$obj_row->id} ";
Yii::app()->db->createCommand($query)->query();
$query = "INSERT INTO " . TBL_MODULE_MENUITEM_REF . " SET moduleID = {$obj_row->id}, menuID = 0 ";
Yii::app()->db->createCommand($query)->query();
} else {
if ($menu_selected == 'selected' and isset($_POST['selection-menu'])) {
$menuids = $_POST['selection-menu'];
foreach ($menuids as $menuid) {
$query = "REPLACE INTO " . TBL_MODULE_MENUITEM_REF . " SET moduleID = {$obj_row->id}, menuID = {$menuid} ";
Yii::app()->db->createCommand($query)->query();
}
} else {
$query = "DELETE FROM " . TBL_MODULE_MENUITEM_REF . " WHERE moduleID = {$obj_row->id} ";
Yii::app()->db->createCommand($query)->query();
}
}
return $obj_row->id;
}
示例4: actionSave
public function actionSave()
{
global $mainframe, $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to modify setting");
$this->redirect(Router::buildLink("cpanel"));
}
$post = Request::get();
$db_info = $post['config']['database'];
$connectionString = '\'mysql:dbname=' . $db_info['databasename'] . ';host=' . $db_info['hostname'] . '\'';
$this->setConfig('main', 'connectionString', $connectionString, 'db', "\\s*\\,\\s*\\'errorHandler");
$this->setConfig('main', 'username', '\'' . $db_info['username'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler");
$this->setConfig('main', 'tablePrefix', '\'' . $db_info['prefix'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler");
$this->setConfig('main', 'adminEmail', '\'' . $post['config']['main']['adminEmail'] . '\'', 'params');
$this->setConfig('main', 'permission', '\'' . $post['config']['main']['permission'] . '\'', 'params');
$this->setConfig('main', 'copyright', '\'' . $post['config']['main']['copyright'] . '\'', 'params');
$this->writeConfig('main');
$this->setConfig('backend', 'timeout', '\'' . $post['config']['backend']['sessionlifetime'] . '\'', 'params');
$this->setConfig('backend', 'timeout2', '\'' . $post['config']['backend']['sessionlifetime2'] . '\'', 'params');
$this->setConfig('backend', 'sessionName', 'md5("' . $post['config']['backend']['sessionname'] . '")', 'session');
$this->writeConfig('backend');
$this->setConfig('frontend', 'timeout', '\'' . $post['config']['site']['sessionlifetime'] . '\'', 'params');
$this->setConfig('frontend', 'timeout2', '\'' . $post['config']['site']['sessionlifetime2'] . '\'', 'params');
$this->setConfig('frontend', 'offlineMessage', '\'' . $post['config']['site']['offlinemessage'] . '\'', 'params');
$this->setConfig('frontend', 'siteoffline', $post['config']['site']['offline'], 'params');
$this->setConfig('frontend', 'sessionName', 'md5("' . $post['config']['site']['sessionname'] . '")', 'session');
$this->setConfig('frontend', 'sef', '\'' . $post['config']['site']['sef'] . '\'', 'params');
$this->setConfig('frontend', 'sef_suffix', '\'' . $post['config']['site']['sef_suffix'] . '\'', 'params');
$this->setConfig('frontend', 'sef_urlsuffix', '\'' . $post['config']['site']['sef_urlsuffix'] . '\'', 'params');
$this->writeConfig('frontend');
YiiMessage::raseSuccess("Successfully saved changes config");
// $this->pageTitle = "Home page Display";
$this->redirect(Router::buildLink("cpanel", array("view" => "sysconfig")));
}
示例5: actionDisplay
public function actionDisplay()
{
global $mainframe, $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to visit page");
$this->redirect(Router::buildLink("cpanel"));
}
$this->addBarTitle("Resource <small>[manager]</small>", "user");
$this->render('default');
}
示例6: addSubMenuGameSportTour
function addSubMenuGameSportTour($view = "tournaments")
{
global $mainframe;
$tourID = Request::getVar('tourID', 0);
$mainframe->addIconSubMenu("Panel", Router::buildLink('gamesport'));
$mainframe->addIconSubMenu("Back", Router::buildLink('gamesport', array('view' => 'tournaments')));
$mainframe->addIconSubMenu("Edit tournament", Router::buildLink('gamesport', array('view' => 'tournaments', 'layout' => 'edit', 'cid' => $tourID)));
$mainframe->addIconSubMenu("Teams Joined", Router::buildLink('gamesport', array('view' => 'tournament', 'tourID' => $tourID)), $view == 'tournament');
$mainframe->addIconSubMenu("Round Table", Router::buildLink('gamesport', array('view' => 'roundtable', 'tourID' => $tourID)), $view == 'roundtable');
$mainframe->addIconSubMenu("Matches", Router::buildLink('gamesport', array('view' => 'matches', 'tourID' => $tourID)), $view == 'matches');
}
示例7: storeItem
function storeItem()
{
global $mainframe, $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to modify category");
$this->redirect(Router::buildLink("categories"));
}
$cid = Request::getVar("id", 0);
$obj_item = YiiCategory::getInstance();
$obj_item = $obj_item->loadItem($cid, "*", false);
$obj_item->bind($_POST);
if ($obj_item->id == 0) {
$obj_item->created_by = $user->id;
}
$obj_item->modified_by = $user->id;
$obj_item->store();
YiiMessage::raseSuccess("Successfully save Category");
return $obj_item->id;
}
示例8: store
function store()
{
global $mainframe, $db, $user;
$tourID = Request::getVar('tourID', 0);
$post = $_POST;
$model = Matches::getInstance();
global $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to change Tournament");
$this->redirect(Router::buildLink("gamesport", array('view' => 'tournament')));
}
$tourID = Request::getVar('tourID', 0);
$db = Yii::app()->db;
$matches_data_table = json_decode($post['matches_data_table']);
$matches_make_first_data = $post['matches_make_first_data'];
if ($matches_make_first_data == 1) {
$model->make_matches($tourID, $matches_data_table);
}
return true;
}
示例9: showNodeTree
function showNodeTree($items, $level = 0)
{
$class = $level > 1 ? "line" : "";
echo '<ul class="' . $class . '">';
$k = 0;
foreach ($items as $item) {
$_class = $k == 0 ? "first" : ($k == count($items) - 1 ? "last" : "");
$img_type = " <img src='/images/icons/affected_{$item->affected}.png' style='height: 16px;' />";
$str_title = '';
$link_edit = Router::buildLink('users', array("view" => "resource", "layout" => "edit", 'cid' => $item->id));
if ($item->status == 1) {
$img_status = " <img src='/images/jassets/icons/tick.png' style='height: 16px;' />";
$str_title = ' <a href="' . $link_edit . '">' . $item->title . '</a>' . $img_type . $img_status;
} else {
$img_status = " <img src='/images/jassets/icons/publish_x.png' style='height: 16px;' />";
$str_title = ' <a href="' . $link_edit . '" style="text-decoration: line-through; color: #999;">' . $item->title . '</a>' . $img_type . $img_status;
}
if (isset($item->data_child) and count($item->data_child) > 0) {
if ($level != 0) {
echo '<li class="folder parent ' . $_class . '">';
echo '<i class="folder-btn btn-open" rel=""></i>';
echo '<input id="cb' . $item->id . '" type="checkbox" value="' . $item->id . '" name="cid[]" onclick="isChecked(this.checked);" />';
echo $str_title;
} else {
echo '<li>';
echo ' <a>' . $item->title . '</a>';
}
$level++;
showNodeTree($item->data_child, $level);
echo '</li>';
} else {
echo '<li class="file ' . $_class . '">';
echo '<input id="cb' . $item->id . '" type="checkbox" value="' . $item->id . '" name="cid[]" onclick="isChecked(this.checked);" />';
echo $str_title;
echo '</li>';
}
$k++;
}
echo '</ul>';
}
示例10: actionBlog
public function actionBlog()
{
$model = Video::getInstance();
$catAlias = Request::getVar('alias', null);
$catID = Request::getVar("id");
$currentPage = Request::getVar('page', 1);
$limit = 12;
$data['alias'] = $catAlias;
$obj_category = $model->getCategory($catID, $catAlias);
if ($obj_category == false) {
$this->redirect(Router::buildLink('videos'));
}
if ($currentPage == 1) {
$data['items'] = $model->getItems($obj_category['id'], true, 5);
}
$start = ($currentPage - 1) * $limit;
$data['items2'] = $model->getItems($obj_category['id'], false, $limit, $start);
if ($obj_category['total'] > $start + $limit) {
$page = $currentPage + 1;
} else {
$page = $currentPage - 1;
}
$catAlias = $obj_category['alias'];
$params = array("view" => "category", "id" => $obj_category['id'], "alias" => $obj_category['alias'], "page" => $page);
$obj_category['pagemore'] = Router::buildLink('videos', $params);
$page_title = $obj_category['title'];
if ($currentPage > 1) {
$page_title = $page_title . " trang {$currentPage}";
}
$page_keyword = $obj_category['metakey'] != "" ? $obj_category['metakey'] : $page_title;
$page_description = $obj_category['metadesc'] != "" ? $obj_category['metadesc'] : $page_title;
setSysConfig("seopage.title", $page_title);
setSysConfig("seopage.keyword", $page_keyword);
setSysConfig("seopage.description", $page_description);
$data['category'] = $obj_category;
$this->render('blog', $data);
}
示例11:
<div class="module row">
<form action="<?php
echo Router::buildLink("articles");
?>
" method="post" name="adminForm">
<input type="hidden" name="id" value="<?php
echo $item->id;
?>
"/>
<div class="col-md-8">
<div class="panel panel-primary">
<div class="panel-heading">
<span><b>Main content</b></span>
</div>
<div class="panel-body">
<?php
echo buildHtml::renderField("label", "id", $item->id, "ID");
?>
<?php
echo buildHtml::renderField("text", "title", $item->title, "Title", "form-control title-generate");
?>
<?php
echo buildHtml::renderField("text", "alias", $item->alias, "Alias", "form-control alias-generate", "Auto-generate from title");
?>
<?php
echo buildHtml::renderField('textarea', "introtext", $item->introtext, "Description");
?>
<?php
echo buildHtml::renderField('editor', "fulltext", $item->fulltext, "Content");
?>
</div>
示例12: deleteExt
function deleteExt()
{
global $mainframe, $user;
if (!$user->isSuperAdmin()) {
YiiMessage::raseNotice("Your account not have permission to modify extension");
$this->redirect(Router::buildLink("cpanel"));
}
$cid = Request::getVar('cid');
//$cid = 1;
$obj_ext = YiiExtensions::getInstance();
$obj_tblExt = $obj_ext->loadExt($cid);
if ($obj_tblExt->required == 1) {
YiiMessage::raseNotice("System is require extention: {$obj_tblExt->name}");
$this->redirect(Router::buildLink("installer", array('view' => 'manager')));
}
//neu ma app: kiem tra menu co dang su dung ext nay khong thi unpublish di
if ($obj_tblExt->type == "app") {
Yii::app()->db->createCommand()->update(TBL_MENU_ITEM, array('status' => 0), 'app = \'' . $obj_tblExt->folder . '\'');
}
//neu ma module: kiem tra co module nao duoc tao ra khong thi unpublish di
if ($obj_tblExt->type == "module") {
// $obj_module = YiiModule::getInstance();
// $items = $obj_module->loadItems(null, 'module = \''. $obj_tblExt->folder.'\'');
Yii::app()->db->createCommand()->update(TBL_MODULES, array('status' => 0), 'module = \'' . $obj_tblExt->folder . '\'');
}
//neu ma theme: thi kiem tra xem co dang la theme default khong
}
示例13: accessRules
public function accessRules()
{
global $db, $user, $mainframe;
$YiiApp = Yii::app();
$app = Request::getVar('app', 'cpanel');
$view = Request::getVar('view', 'cpanel');
$layout = Request::getVar('layout', 'cpanel');
if (is_object($user) and $user->isLogin()) {
if (!$user->isAdmin()) {
YiiMessage::raseWarning("Your account not have permission to visit backend page");
Yii::app()->session['userbackend'] = null;
$this->redirect(Router::buildLink("users", array("view" => 'user', 'layout' => 'logout')));
// $this->redirect(array('users/logout'));
return;
}
if ($app == "users" and $view == "user" and $layout == "login") {
$this->redirect(Router::buildLink("cpanel"));
// $this->redirect(array('/cpanel'));
return;
}
return array();
$return = array(array('allow', 'actions' => array("templates"), 'users' => array('*')));
return $return;
} else {
if ($app == "users" and $view == "user" and $layout == "login") {
return array(array('allow', 'actions' => array("login"), 'users' => array('*')), array('allow', 'users' => array('@')), array('deny', 'users' => array('*')));
} else {
$this->redirect(Router::buildLink("users", array("view" => 'user', 'layout' => 'login')));
// return array();
}
}
}
示例14: actionRemove
function actionRemove()
{
global $user;
$cids = Request::getVar("cid", 0);
$obj_table = YiiTables::getInstance(TBL_VIDEOS);
if (count($cids) > 0) {
for ($i = 0; $i < count($cids); $i++) {
$cid = $cids[$i];
$obj_table->load($cid);
if (!($bool = $user->modifyChecking($obj_table->created_by))) {
$obj_users = YiiUser::getInstance();
$item_user = $obj_users->getUser($obj_table->created_by);
YiiMessage::raseNotice("Your account not have permission to delete video: {$obj_table->title}");
$this->redirect(Router::buildLink("videos"));
return false;
}
//check item first
$obj_table->remove($cid);
}
}
YiiMessage::raseSuccess("Successfully remove Video(s)");
$this->redirect(Router::buildLink("videos"));
}
示例15: logout
function logout($cid)
{
Yii::app()->user->logout();
$link = Router::buildLink("users", array("view" => "user", 'layout' => 'login'));
Yii::app()->getRequest()->redirect($link, true, 302);
}