本文整理汇总了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;
}
示例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));
}
示例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
示例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;
}