當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Alert::danger方法代碼示例

本文整理匯總了PHP中Alert::danger方法的典型用法代碼示例。如果您正苦於以下問題:PHP Alert::danger方法的具體用法?PHP Alert::danger怎麽用?PHP Alert::danger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Alert的用法示例。


在下文中一共展示了Alert::danger方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /**
  * 初始化
  */
 public function init()
 {
     parent::init();
     $this->topic = new TopicModel();
     $this->referer = isset($_SERVER["HTTP_REFERER"]) ? str_replace('http://' . $_SERVER['HTTP_HOST'], '', $_SERVER["HTTP_REFERER"]) : '/admin/index/index';
     //設置白名單(在白名單內不需要tid,否則需要提供tid
     //這樣可以避免在專題相關的控製器和方法中再次判斷 用戶對專題權限
     $url_arr = array("/admin/topic/index", "/admin/topic/index/", "/admin/topicdata/index", "/admin/topicdata/index/", "/admin/topic/add/", "/admin/topic/add", "/admin/topicdata/trashindex", "/admin/topicdata/trashindex/");
     if (!in_array($_SERVER['REQUEST_URI'], $url_arr)) {
         $tid = $this->getRequest()->getQuery("tid");
         //如果不存在tid 非法請求
         if (!$tid) {
             Alert::danger("非法請求");
             Yaf_Controller_Abstract::redirect("/admin/topic/index/");
             exit;
         }
         //根據tid查詢當前用戶是否是管理員或者是該專題的所有者,如果不是則提示權限不足
         if (!$this->checkrole($tid)) {
             Alert::danger("權限不足");
             Yaf_Controller_Abstract::redirect("/admin/topic/index/");
             exit;
         }
     }
     //判斷是否是管理員 並賦值給模板
     $this->getView()->assign("is_admin", $this->is_admin());
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:29,代碼來源:Topicbase.php

示例2: export2excelAction

 /**
  * 將專題文章導出為excel表格
  */
 public function export2excelAction()
 {
     $data = [];
     $where = '';
     $startTime = $this->getRequest()->getQuery('starttime') ? $this->getRequest()->getQuery('starttime') : date('Ymd', time());
     $endTime = $this->getRequest()->getQuery('endtime') ? $this->getRequest()->getQuery('endtime') : date('Ymd', time());
     if (!$this->is_admin()) {
         $where .= "userid=" . $this->_user['uid'];
         $where .= " AND status=1";
     } else {
         $where .= " status=1";
     }
     if ((int) $this->getRequest()->getQuery('tid')) {
         $tid = (int) $this->getRequest()->getQuery('tid');
         $data['topic_name'] = $this->topic->get('topic', 'topic_name', ['topic_id' => $tid]);
         $where .= " AND tid= '{$tid}'";
     } else {
         Alert::danger("參數錯誤");
         Yaf_Controller_Abstract::redirect($this->referer);
         exit;
     }
     if ($this->getRequest()->getPost('sid')) {
         $where .= " AND sid=" . $this->getRequest()->getPost('sid');
         $this->getView()->assign('sid', $this->getRequest()->getPost('sid'));
     } elseif ($this->getRequest()->getQuery('sid')) {
         $where .= " AND sid=" . $this->getRequest()->getQuery('sid');
         $this->getView()->assign('sid', $this->getRequest()->getQuery('sid'));
     }
     //判斷是否有搜索條件
     if ($this->getRequest()->getPost('id', 0)) {
         $where .= " AND id=" . $this->getRequest()->getPost('id');
         $this->getView()->assign('id', $this->getRequest()->getPost('id'));
     }
     if ($this->getRequest()->getPost('title', 0)) {
         $where .= " AND title LIKE '%" . $this->getRequest()->getPost('title');
         $where .= "%'";
         $this->getView()->assign('title', $this->getRequest()->getPost('title'));
     }
     if ($startTime && $endTime) {
         $startTime = strtotime($startTime . '000000');
         $endTime = strtotime($endTime . '235959');
         if ($startTime < $endTime) {
             $where .= " AND (inputtime BETWEEN '{$startTime}' AND '{$endTime}')";
         } else {
             Alert::danger("參數錯誤");
             Yaf_Controller_Abstract::redirect($this->referer);
             exit;
         }
     } else {
         Alert::danger("參數錯誤");
         Yaf_Controller_Abstract::redirect($this->referer);
         exit;
     }
     $where2 = $where;
     $where .= " ORDER BY id ASC";
     $sql = "SELECT id,title,tid,sid,userid,username,status,inputtime FROM topic_data WHERE {$where}";
     //echo $sql;
     $data['data'] = $this->topic->query($sql);
     //獲取專題path
     foreach ($data['data'] as $k => $v) {
         $data['data'][$k]['topic_path'] = $this->topic->get("topic", "topic_path", ["topic_id" => $v['tid'], "LIMIT" => 1]);
     }
     unset($where);
     //獲取當期用戶所有的欄目
     if (!$this->is_admin()) {
         $where['userid'] = $this->_user['uid'];
     }
     $where['ORDER'] = ["parent_id ASC", "id ASC"];
     $subclass_list = $this->topic->select('topic_subclass', ['id', 'title', 'path'], $where);
     foreach ($subclass_list as $k => $v) {
         $subclass[$v['id']] = $v;
     }
     $this->getView()->assign('subclass', $subclass);
     $this->getView()->assign('subclass_list', $subclass_list);
     $this->getView()->assign('data', $data);
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:79,代碼來源:Topicdata.php

示例3: PDO

} else {
    echo "<a href='#' class='ui secondary button disabled'>Install</a><br><br>";
}
$step = 1;
$done = false;
/*
 * Step 1
 * Install database
 */
if (isset($_POST["post1"])) {
    $sql_host = $_POST["sql_host"];
    $sql_name = $_POST["sql_name"];
    $sql_user = $_POST["sql_user"];
    $sql_pass = $_POST["sql_pass"];
    if (empty($sql_host) || empty($sql_name) || empty($sql_user) || empty($sql_pass)) {
        echo $alert->danger("Tous les champs sont requis!");
    } else {
        try {
            $pdo = new PDO("mysql:host={$sql_host};dbname={$sql_name};", $sql_user, $sql_pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
            $sql_error = false;
        } catch (PDOException $ex) {
            $sql_error = true;
        }
        if ($sql_error == true) {
            echo $alert->danger("Erreur MySQL!");
        } else {
            $dbFile = fopen("../app/Config/database.php", "w");
            $databaseStructure = "<?php\nclass DATABASE_CONFIG {\n    public \$default = array(\n        'datasource' => 'Database/Mysql',\n        'persistent' => false,\n        'host' => '{$sql_host}', // Hôte\n        'login' => '{$sql_user}', // Nom d'utilisateur\n        'password' => '{$sql_pass}', // Mot de passe\n        'database' => '{$sql_name}', // Database\n        'prefix' => 'extaz_',\n        'encoding' => 'utf8',\n    );\n}";
            fwrite($dbFile, $databaseStructure);
            fclose($dbFile);
            $sql = file_get_contents("ExtazCMS.sql");
開發者ID:Mortex68,項目名稱:ExtazCMS,代碼行數:31,代碼來源:index.php

示例4: deleteAction

 /**
  * 刪除欄目
  * @param void
  * @return void
  */
 function deleteAction()
 {
     //接收參數
     $category_id = (int) $_GET['cid'];
     //暫不考慮管理員權限
     if ($category_id) {
         $result = $this->category->delete_category($category_id);
         if (!$result) {
             Alert::danger('刪除失敗');
             Yaf_Controller_Abstract::redirect("/admin/category/index/");
         } else {
             Alert::success('刪除成功');
             Yaf_Controller_Abstract::redirect("/admin/category/index/");
         }
     } else {
         Yaf_Controller_Abstract::redirect("/admin/category/index/");
     }
     exit;
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:24,代碼來源:Category.php

示例5: changeTopicStatusAction

 /**
  * 改變專題狀態
  */
 public function changeTopicStatusAction()
 {
     (int) ($topic_id = $this->getRequest()->getQuery('tid'));
     $data['is_show'] = $this->getRequest()->getQuery('isshow');
     if (!$topic_id) {
         Alert::danger("非法請求");
         Yaf_Controller_Abstract::redirect($this->referer);
         exit;
     }
     //判斷當前操作者是否具有權限
     if (!$this->checkrole($topic_id)) {
         Alert::danger("權限錯誤");
         Yaf_Controller_Abstract::redirect($this->referer);
         exit;
     }
     if ($this->topic->update('topic', $data, ['topic_id' => $topic_id])) {
         Alert::success("操作成功");
         Yaf_Controller_Abstract::redirect($this->referer);
     } else {
         Alert::danger("操作失敗");
         Yaf_Controller_Abstract::redirect($this->referer);
     }
     exit;
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:27,代碼來源:Topic.php

示例6: changeSubStatus

 /**
  * 改變子類的狀態
  */
 public function changeSubStatus()
 {
     $subclass_id = $this->getRequest()->getQuery('sid');
     if (!$subclass_id) {
         Alert::danger("非法請求");
         Yaf_Controller_Abstract::redirect($this->referer);
         exit;
     }
     //判斷當前操作者是否具有權限
     if (!$this->checkrole($subclass_id, "topic_subclass")) {
         Alert::danger("權限出錯");
         Yaf_Controller_Abstract::redirect($this->referer);
         exit;
     }
     $data['status'] = $this->getRequest()->getQuery('status');
     if ($this->topic->update_subclass($subclass_id, $data)) {
         Alert::success("權限出錯");
     } else {
         Alert::danger("權限出錯");
     }
     Yaf_Controller_Abstract::redirect("/admin/topicsubclass/index/");
     exit;
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:26,代碼來源:Topicsubclass.php

示例7: reductionAction

 /**
  * 將回收站裏麵的文章還原到文章列表中
  * @author maczhis@gmail.com
  */
 public function reductionAction()
 {
     $id = $this->getRequest()->getQuery('id');
     if ($id) {
         $data['status'] = 99;
         $data['updatetime'] = $_SERVER['time'];
         if ($this->db_document->document_trash($id, $data)) {
             $memkey = MEMPREFIX . 'article:detail' . $id;
             $this->memcache->delete($memkey);
             Alert::success("操作成功");
         } else {
             Alert::danger("操作失敗");
         }
         Yaf_Controller_Abstract::redirect("/admin/document/trashindex");
         exit;
     }
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:21,代碼來源:Document.php

示例8: statusToggle

 public function statusToggle($id)
 {
     $user = $this->usersRepo->findOrFail($id);
     if ($user->isBlocked()) {
         $user->blocked_at = null;
         \Alert::success("CMS::users.msg_user_unblocked");
     } else {
         if ($user->id == $this->current_user->id) {
             \Alert::danger("CMS::users.msg_you_cant_block_yourself");
             return redirect()->back();
         }
         $user->blocked_at = Carbon::now();
         \Alert::success("CMS::users.msg_user_blocked");
     }
     $this->usersRepo->save($user);
     return redirect()->route('CMS::admin.users.edit', $user->id);
 }
開發者ID:socieboy,項目名稱:reactor-cms,代碼行數:17,代碼來源:UserController.php


注:本文中的Alert::danger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。