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


PHP Section::all方法代码示例

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


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

示例1: testFirst

 public function testFirst()
 {
     $this->assertSame($this->wipf1, $this->section->first('Wipf'));
     $this->assertSame($this->shark, $this->section->first());
     $this->assertSame(array($this->wipf1, $this->wipf2), $this->section->all('Wipf'));
     $this->assertSame(array($this->shark, $this->wipf1, $this->wipf2), $this->section->all());
     $this->assertNull($this->section->first('Clonk'));
     $this->assertEmpty($this->section->all('Clonk'));
 }
开发者ID:beheh,项目名称:sulphur,代码行数:9,代码来源:SectionTest.php

示例2: index

 /**
  * Display a listing of the resource.
  * GET /sections
  *
  * @return Response
  */
 public function index()
 {
     return Section::all();
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:10,代码来源:SectionsController.php

示例3: getAddTrainerModal

 public function getAddTrainerModal()
 {
     $semesters = Semester::all();
     $sections = Section::all();
     return View::make('admin.modals.addTrainer')->with('semesters', $semesters)->with('sections', $sections);
 }
开发者ID:uTosTan,项目名称:codesamples,代码行数:6,代码来源:AdminController.php

示例4: 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

示例5: function

 * 	include_default - (optional)  Should the default section be included (default: No).
 * 
 * Tag Content:
 * 	The tag's content will be executed for every section. The current section will be written to the variable specified by the var parameter before.
 *
 * Returns:
 * 	All results from the tag content.
 */
$ste->register_tag("section_list", function ($ste, $params, $sub) {
    global $ratatoeskr_settings;
    $lang = $ste->vars["language"];
    $default_section = $ratatoeskr_settings["default_section"];
    if (!isset($params["var"])) {
        throw new \ste\RuntimeException("Parameter var is needed in article_get!");
    }
    $result = Section::all();
    if (isset($params["exclude"])) {
        $exclude = explode(",", $params["exclude"]);
        $result = array_filter($result, function ($section) use($exclude) {
            return !in_array($section->name, $exclude);
        });
    }
    $result = array_filter($result, function ($section) use($default_section) {
        return $section->get_id() != $default_section;
    });
    $result = array_map(function ($section) use($lang) {
        return section_transform_ste($section, $lang);
    }, $result);
    if ($ste->evalbool($params["include_default"])) {
        $default = section_transform_ste(Section::by_id($default_section), $lang);
        array_unshift($result, $default);
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:31,代码来源:frontend.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $sections = $this->section->all();
     return View::make('sections.index', compact('sections'));
 }
开发者ID:bailey9005,项目名称:Laravel-For-Landing-Pages,代码行数:10,代码来源:SectionsController.php


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