当前位置: 首页>>代码示例>>PHP>>正文


PHP Style::all方法代码示例

本文整理汇总了PHP中Style::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::all方法的具体用法?PHP Style::all怎么用?PHP Style::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Style的用法示例。


在下文中一共展示了Style::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: styles

 /**
  * Styles index page
  * @return View
  */
 public function styles()
 {
     $styles = [];
     foreach (Style::all() as $style) {
         $styles[] = Style::find($style->id);
     }
     return View::make('backend.style.index', ['styles' => $styles]);
 }
开发者ID:andreuramos,项目名称:beers,代码行数:12,代码来源:DashboardController.php

示例2: index

 /**
  * Display a listing of styles
  *
  * @return Response
  */
 public function index()
 {
     if (Request::ajax()) {
         $styles = Style::all();
         return Response::json($styles);
     } else {
         $styles = Style::all();
         return View::make('styles.index', compact('styles'));
     }
 }
开发者ID:hopshoppub,项目名称:hopshop.dev,代码行数:15,代码来源:StylesController.php

示例3: build_backend_subactions

function build_backend_subactions()
{
    global $backend_subactions, $pluginpages_handlers;
    $backend_subactions = url_action_subactions(array("_index" => url_action_alias(array("login")), "index" => url_action_alias(array("login")), "_prelude" => function (&$data, $url_now, &$url_next) {
        global $ratatoeskr_settings, $admin_grp, $ste, $languages;
        if ($admin_grp === NULL) {
            $admin_grp = Group::by_name("admins");
        }
        $ste->vars["all_languages"] = array();
        $ste->vars["all_langcodes"] = array();
        foreach ($languages as $code => $data) {
            $ste->vars["all_languages"][$code] = $data["language"];
            $ste->vars["all_langcodes"][] = $code;
        }
        ksort($ste->vars["all_languages"]);
        sort($ste->vars["all_langcodes"]);
        /* Check authentification */
        if (isset($_SESSION["ratatoeskr_uid"])) {
            try {
                $user = User::by_id($_SESSION["ratatoeskr_uid"]);
                if ($user->pwhash == $_SESSION["ratatoeskr_pwhash"] and $user->member_of($admin_grp)) {
                    if (empty($user->language)) {
                        $user->language = $ratatoeskr_settings["default_language"];
                        $user->save();
                    }
                    load_language($user->language);
                    if ($url_next[0] == "login") {
                        $url_next = array("content", "write");
                    }
                    $data["user"] = $user;
                    $ste->vars["user"] = array("id" => $user->get_id(), "name" => $user->username, "lang" => $user->language);
                    return;
                    /* Authentification successful, continue  */
                } else {
                    unset($_SESSION["ratatoeskr_uid"]);
                }
            } catch (DoesNotExistError $e) {
                unset($_SESSION["ratatoeskr_uid"]);
            }
        }
        load_language();
        /* If we are here, user is not logged in... */
        $url_next = array("login");
    }, "login" => url_action_simple(function ($data) {
        global $ste, $admin_grp;
        if (!empty($_POST["user"])) {
            try {
                $user = User::by_name($_POST["user"]);
                if (!PasswordHash::validate($_POST["password"], $user->pwhash)) {
                    throw new Exception();
                }
                if (!$user->member_of($admin_grp)) {
                    throw new Exception();
                }
                /* Login successful. */
                $_SESSION["ratatoeskr_uid"] = $user->get_id();
                $_SESSION["ratatoeskr_pwhash"] = $user->pwhash;
                load_language($user->language);
                $data["user"] = $user;
                $ste->vars["user"] = array("id" => $user->get_id(), "name" => $user->username, "lang" => $user->language);
            } catch (Exception $e) {
                $ste->vars["login_failed"] = True;
            }
            if (isset($data["user"])) {
                throw new Redirect(array("content", "write"));
            }
        }
        echo $ste->exectemplate("/systemtemplates/backend_login.html");
    }), "logout" => url_action_simple(function ($data) {
        unset($_SESSION["ratatoeskr_uid"]);
        unset($_SESSION["ratatoeskr_pwhash"]);
        load_language();
        throw new Redirect(array("login"));
    }), "content" => url_action_subactions(array("write" => function (&$data, $url_now, &$url_next) {
        global $ste, $translation, $textprocessors, $ratatoeskr_settings, $languages, $articleeditor_plugins;
        list($article, $editlang) = array_slice($url_next, 0);
        if (!isset($editlang)) {
            $editlang = $data["user"]->language;
        }
        if (isset($article)) {
            $ste->vars["article_editurl"] = urlencode($article) . "/" . urlencode($editlang);
        } else {
            $ste->vars["article_editurl"] = "";
        }
        $url_next = array();
        $default_section = Section::by_id($ratatoeskr_settings["default_section"]);
        $ste->vars["section"] = "content";
        $ste->vars["submenu"] = isset($article) ? "articles" : "newarticle";
        $ste->vars["textprocessors"] = array();
        foreach ($textprocessors as $txtproc => $properties) {
            if ($properties[1]) {
                $ste->vars["textprocessors"][] = $txtproc;
            }
        }
        $ste->vars["sections"] = array();
        foreach (Section::all() as $section) {
            $ste->vars["sections"][] = $section->name;
        }
        $ste->vars["article_section"] = $default_section->name;
        /* Check Form */
//.........这里部分代码省略.........
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:101,代码来源:backend.php

示例4: edit_vars

 public static function edit_vars(&$vars, $id)
 {
     $vars['brewery'] = Brewery::find($vars['val']->brewery_id);
     $vars['styles'] = Style::all();
 }
开发者ID:Rochet2,项目名称:Tsoha-Bootstrap,代码行数:5,代码来源:beer_controller.php


注:本文中的Style::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。