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


PHP Model_Content::find方法代码示例

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


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

示例1: action_index

 public function action_index()
 {
     $data["trial"] = Model_Content::find("all", ["where" => [["type_id", -1], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $data["enchant"] = Model_Content::find("all", ["where" => [["type_id", 0], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]);
     $view = View::forge("teachers/textbooks", $data);
     $this->template->content = $view;
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:7,代码来源:textbooks.php

示例2: post_changecontenttype

 public function post_changecontenttype()
 {
     $code = 0;
     $message = "ok";
     if ($this->auth_status) {
         $content = Model_Content::find(Input::post("id", 0));
         if ($content != null) {
             $content->type_id = Input::post("type_id", 0);
             $content->text_type_id = Input::post("text_type_id", 0);
             $content->exam = NULL;
             $content->save();
         } else {
             $code = 404;
             $message = "Content not found.";
         }
     } else {
         $code = 500;
         $message = "Auth error.";
     }
     $this->response(array('code' => $code, 'message' => $message));
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:21,代码来源:api.php

示例3:

            echo $reservation->number;
            ?>
 / 12 Lessons
						<?php 
        } else {
            ?>
							<span class="icon-course1"><?php 
            echo Model_Lessontime::getCourse($reservation->language);
            ?>
</span>
						<?php 
        }
        ?>
					</div>
					<?php 
        $text = Model_Content::find("first", ["where" => [["number", $reservation->number], ["type_id", $reservation->language], ["text_type_id", 0], ["deleted_at", 0]]]);
        if ($text != null) {
            ?>
					<p class="textbook"><?php 
            echo Html::anchor("contents/{$text->path}", '<i class="fa fa-fw fa-book"></i> ', ["target" => "_blank"]);
            ?>
</p>
					<?php 
        }
        ?>
				</li>
				<?php 
    }
    ?>
			</ul>
			<?php 
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:31,代码来源:top.php

示例4: action_index

 public function action_index()
 {
     if (Input::post("t_id", 0) != 0) {
         $content = Model_Content::find(Input::post("t_id", 0));
         if ($content != null) {
             $content->text_type_id = Input::post("text_type_id", 0);
             $content->save();
         }
     }
     if (Input::post("n_id", 0) != 0) {
         $content = Model_Content::find(Input::post("n_id", 0));
         if ($content != null) {
             $content->number = Input::post("number", 0);
             $content->save();
         }
     }
     if (Input::post("e_id", 0) != 0) {
         $content = Model_Content::find(Input::post("e_id", 0));
         if ($content != null) {
             $content->exam = Input::post("course_val", 0);
             $content->text_type_id = 2;
             $content->save();
         }
     }
     // add
     if (Input::post("type", null) != null and Security::check_token()) {
         if (is_uploaded_file($_FILES["file"]["tmp_name"])) {
             $ext = explode(".", $_FILES["file"]["name"]);
             if (strtolower($ext[1]) == "pdf" or strtolower($ext[1]) == "doc" or strtolower($ext[1]) == "docx") {
                 $filename = str_replace("/", "", $_FILES["file"]["name"]);
                 $filepath = DOCROOT . "contents/" . $filename;
                 if (move_uploaded_file($_FILES["file"]["tmp_name"], $filepath)) {
                     chmod($filepath, 0644);
                     // save
                     $cs = Input::post("course");
                     $courses = NULL;
                     if (null != Input::post("course")) {
                         foreach ($cs as $course) {
                             $courses = $courses . $course;
                         }
                         $content = Model_Content::forge();
                         $content->path = $filename;
                         $content->type_id = Input::post("type");
                         $content->number = 0;
                         $content->text_type_id = 2;
                         $content->exam = $courses;
                         $content->save();
                     } else {
                         $content = Model_Content::forge();
                         $content->path = $filename;
                         $content->type_id = Input::post("type");
                         $content->number = Input::post("number");
                         $content->text_type_id = Input::post("text_type");
                         $content->exam = NULL;
                         $content->save();
                     }
                 } else {
                     Response::redirect("/admin/contents/?e=1");
                 }
             } else {
                 Response::redirect("/admin/contents/?e=1");
             }
         }
     }
     $where = [["deleted_at", 0]];
     if (Input::get("search_type", 0) != 0) {
         array_push($where, ["type_id" => Input::get("search_type", 0) - 1]);
     }
     $data["contents"] = Model_Content::find("all", ["where" => $where, "order_by" => [["type_id", "asc"], ["number", "asc"], ["text_type_id", "asc"]]]);
     $config = array('pagination_url' => "?search_type=" . Input::get("search_type", 0), 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 100, 'total_items' => count($data["contents"]));
     $data["pager"] = Pagination::forge('mypagination', $config);
     $data["contents"] = array_slice($data["contents"], $data["pager"]->offset, $data["pager"]->per_page);
     $view = View::forge("admin/contents/index", $data);
     $this->template->content = $view;
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:75,代码来源:contents.php


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