本文整理汇总了PHP中Model_Content类的典型用法代码示例。如果您正苦于以下问题:PHP Model_Content类的具体用法?PHP Model_Content怎么用?PHP Model_Content使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Model_Content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$model = new Model_Content();
$content = $model->getContent();
$this->template->vars('content', $content);
$this->template->view('index');
}
示例2: 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;
}
示例3: action_goal
/**
* action product goal after buying
* @return void
*/
public function action_goal()
{
if (!Auth::instance()->logged_in()) {
$this->redirect(Route::get('oc-panel')->uri());
}
$user = Auth::instance()->get_user();
$order = new Model_Order();
$order->where('id_order', '=', $this->request->param('id'))->where('id_user', '=', $user->id_user)->limit(1)->find();
if ($order->loaded()) {
$product = $order->product;
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title($product->category->name)->set_url(Route::url('list', array('category' => $product->category->seoname))));
Breadcrumbs::add(Breadcrumb::factory()->set_title($product->title)->set_url(Route::url('product', array('seotitle' => $product->seotitle, 'category' => $product->category->seoname))));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Thanks')));
$this->template->title = $product->title . ' - ' . $product->category->name;
$this->template->meta_description = $product->description;
$thanks_message = NULL;
if (core::config('payment.thanks_page') != '') {
$thanks_message = Model_Content::get_by_title(core::config('payment.thanks_page'));
}
$this->template->bind('content', $content);
$this->template->content = View::factory('pages/product/goal', array('product' => $product, 'thanks_message' => $thanks_message, 'order' => $order, 'price_paid' => $order->amount));
} else {
Alert::set(Alert::INFO, __('Order not found.'));
$this->redirect(Route::url('default'));
}
}
示例4: action_205
/**
* This function will upgrate DB that didn't existed in verisons below 2.0.5
* changes added: subscription widget, new email content, map zoom, paypal seller etc..
*/
public function action_205()
{
// build array with new (missing) configs
$configs = array(array('config_key' => 'paypal_seller', 'group_name' => 'payment', 'config_value' => '0'), array('config_key' => 'map_zoom', 'group_name' => 'advertisement', 'config_value' => '16'), array('config_key' => 'center_lon', 'group_name' => 'advertisement', 'config_value' => '3'), array('config_key' => 'center_lat', 'group_name' => 'advertisement', 'config_value' => '40'), array('config_key' => 'new_ad_notify', 'group_name' => 'email', 'config_value' => '0'));
$contents = array(array('order' => '0', 'title' => 'Advertisement `[AD.TITLE]` is created on [SITE.NAME]!', 'seotitle' => 'ads.subscribers', 'description' => "Hello [USER.NAME],\n\nYou may be interested in this one [AD.TITLE]!\n\nYou can visit this link to see advertisement [URL.AD]", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'), array('order' => '0', 'title' => 'Advertisement `[AD.TITLE]` is created on [SITE.NAME]!', 'seotitle' => 'ads.to_admin', 'description' => "Click here to visit [URL.AD]", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'));
// returns TRUE if some config is saved
$return_conf = Model_Config::config_array($configs);
$return_cont = Model_Content::content_array($contents);
$prefix = Database::instance()->table_prefix();
$config_db = Kohana::$config->load('database');
$charset = $config_db['default']['charset'];
/*
@todo NOT DINAMIC, get charset
*/
mysql_query("CREATE TABLE IF NOT EXISTS `" . $prefix . "subscribers` (\n `id_subscribe` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `id_user` int(10) unsigned NOT NULL,\n `id_category` int(10) unsigned NOT NULL DEFAULT '0',\n `id_location` int(10) unsigned NOT NULL DEFAULT '0',\n `min_price` decimal(14,3) NOT NULL DEFAULT '0',\n `max_price` decimal(14,3) NOT NULL DEFAULT '0',\n `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n PRIMARY KEY (`id_subscribe`)\n ) ENGINE=MyISAM DEFAULT CHARSET=" . $charset . ";");
// remove INDEX from content table
mysql_query("ALTER TABLE `" . $prefix . "content` DROP INDEX `" . $prefix . "content_UK_seotitle`");
}
示例5: action_view
/**
*
* Display single faq
* @throws HTTP_Exception_404
*/
public function action_view($seotitle)
{
$faq = Model_Content::get_by_title($seotitle, 'help');
if ($faq->loaded()) {
Breadcrumbs::add(Breadcrumb::factory()->set_title($faq->title));
$this->template->title = $faq->title . ' - ' . __(' Frequently Asked Questions - FAQ');
$this->template->meta_description = $faq->description . ' - ' . __(' Frequently Asked Questions - FAQ');
$this->template->bind('content', $content);
if ($faq->status == 1 and strlen(core::config('general.faq_disqus')) > 0) {
$disqus = View::factory('pages/disqus', array('disqus' => core::config('general.faq_disqus')));
} else {
$disqus = '';
}
$this->template->content = View::factory('pages/faq/single', array('faq' => $faq, 'disqus' => $disqus));
} else {
//throw 404
throw HTTP_Exception::factory(404, __('Page not found'));
}
}
示例6: action_view
/**
*
* Display single page
* @throws HTTP_Exception_404
*/
public function action_view()
{
$seotitle = $this->request->param('seotitle', NULL);
if ($seotitle !== NULL) {
$page = Model_Content::get_by_title($seotitle);
if ($page->loaded()) {
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title($page->title));
$this->template->title = $page->title;
$this->template->meta_description = $page->description;
$this->template->bind('content', $content);
$this->template->content = View::factory('page', array('page' => $page));
} else {
//throw 404
throw HTTP_Exception::factory(404, __('Page not found'));
}
} else {
//throw 404
throw HTTP_Exception::factory(404, __('Page not found'));
}
}
示例7: action_affiliates
/**
* affiliate configuration can be configured here
* @return [view] Renders view with form inputs
*/
public function action_affiliates()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Affiliates')));
$this->template->title = __('Affiliates');
$this->template->scripts['footer'][] = 'js/jquery.validate.min.js';
$this->template->scripts['footer'][] = 'js/oc-panel/settings.js';
// all form config values
$paymentconf = new Model_Config();
$config = $paymentconf->where('group_name', '=', 'affiliate')->find_all();
// save only changed values
if ($this->request->post()) {
$validation = Validation::factory($this->request->post())->rule('active', 'range', array(':value', 0, 1))->rule('cookie', 'not_empty')->rule('cookie', 'digit')->rule('payment_days', 'not_empty')->rule('payment_days', 'digit')->rule('payment_min', 'not_empty')->rule('payment_min', 'digit');
if ($validation->check()) {
foreach ($config as $c) {
$config_res = $this->request->post($c->config_key);
if ($config_res != $c->config_value) {
$c->config_value = $config_res;
try {
$c->save();
} catch (Exception $e) {
echo $e;
}
}
}
} else {
$errors = $validation->errors('config');
foreach ($errors as $error) {
Alert::set(Alert::ALERT, $error);
}
$this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'affiliates')));
}
Alert::set(Alert::SUCCESS, __('Affiliate Configuration updated'));
$this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'affiliates')));
}
$pages = array('' => __('Deactivated'));
foreach (Model_Content::get_pages() as $key => $value) {
$pages[$value->seotitle] = $value->title;
}
$this->template->content = View::factory('oc-panel/pages/settings/affiliates', array('config' => $config, 'pages' => $pages));
}
示例8: defined
<?php
defined('SYSPATH') or die('No direct script access.');
if (!isset($_COOKIE['accept_terms']) and core::config('general.alert_terms') != '') {
?>
<div id="accept_terms_modal" class="modal fade" data-backdrop="static">
<?php
$content = Model_Content::get_by_title(core::config('general.alert_terms'));
?>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" onclick='location.href="http://www.google.com"' aria-hidden="true">×</button>
<h1><?php
echo $content->title;
?>
</h1>
</div>
<div class="modal-body">
<div class="text-description"><?php
echo Text::bb2html($content->description, TRUE, FALSE);
?>
</div>
</div>
<div class="modal-footer">
<a name="decline_terms" class="btn btn-default" onclick='location.href="http://www.google.com"' ><?php
echo __('No');
?>
</a>
<a name="accept_terms" class="btn btn-success" onclick='setCookie("accept_terms",1,10000)' data-dismiss="modal" aria-hidden="true"><?php
echo __('I accept');
示例9: __
<div class="form-group">
<?php
echo FORM::label($forms['contact']['key'], __('Contact form'), array('class' => 'control-label col-sm-3', 'for' => $forms['contact']['key']));
?>
<div class="col-sm-4">
<?php
echo FORM::select($forms['contact']['key'], array(FALSE => "FALSE", TRUE => "TRUE"), $forms['contact']['value'], array('placeholder' => "", 'class' => 'tips form-control', 'id' => $forms['contact']['key'], 'data-content' => __("Enables Contact Form"), 'data-trigger' => "hover", 'data-placement' => "right", 'data-toggle' => "popover", 'data-original-title' => __("Contact form appears int he ad.")));
?>
</div>
</div>
<?php
$pages = array('' => __('Deactivated'));
?>
<?php
foreach (Model_Content::get_pages() as $key => $value) {
$pages[$value->seotitle] = $value->title;
}
?>
<div class="form-group">
<?php
echo FORM::label($forms['tos']['key'], "<a target='_blank' href='http://open-classifieds.com/2013/08/13/how_to_add_pages/'>" . __('Terms of Service') . "</a>", array('class' => 'control-label col-sm-3', 'for' => $forms['tos']['key']));
?>
<div class="col-sm-4">
<?php
echo FORM::select($forms['tos']['key'], $pages, $forms['tos']['value'], array('placeholder' => "http://foo.com/", 'class' => 'tips form-control', 'id' => $forms['tos']['key'], 'data-content' => __("If you choose to use terms of service, you can select activate. And to edit content, select link 'Content' on your admin panel sidebar. Find page named 'Terms of service' click 'Edit'. In section 'Description' add content that suits you."), 'data-trigger' => "hover", 'data-placement' => "right", 'data-toggle' => "popover", 'data-original-title' => __("Terms of Service")));
?>
</div>
</div>
<div class="form-group">
示例10:
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
示例11: getByNid
public function getByNid($nid)
{
$model = new Model_Content();
return $model->getByNid($nid);
}
示例12: action_delete
/**
* action: DELETE
*/
public function action_delete()
{
$this->auto_render = FALSE;
$id = $this->request->param('id');
$content = new Model_Content($id);
$type = $content->type;
$locale = $content->locale;
if ($content->loaded()) {
try {
$content->delete();
Cache::instance()->delete_all();
$this->template->content = 'OK';
Alert::set(Alert::SUCCESS, __('Content is deleted'));
} catch (Exception $e) {
Alert::set(Alert::ERROR, $e->getMessage());
}
} else {
Alert::set(Alert::INFO, __('Content is not deleted'));
}
Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'list')) . '?type=' . $type . '&locale_select=' . $locale);
}
示例13: action_saveorder
/**
* saves the content in a specific order
* @return void
*/
public function action_saveorder()
{
$this->auto_render = FALSE;
$this->template = View::factory('js');
$locale = core::get('locale_select', core::config('i18n.locale'));
if ($contents = Model_Content::get_contents(core::get('type'), $locale)) {
$order = Core::get('order');
//using order they send us
foreach ($order as $key => $value) {
$c = new Model_Content($value);
$c->order = $key;
$c->save();
}
Core::delete_cache();
$this->template->content = __('Saved');
} else {
$this->template->content = __('Error');
}
}
示例14: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
$this->page_items = Model_Content::get_pages();
}
示例15: action_203
/**
* This function will upgrade configs that didn't existed in versions prior to 2.0.3
*/
public function action_203()
{
// build array with new (missing) configs
$configs = array(array('config_key' => 'watermark', 'group_name' => 'image', 'config_value' => '0'), array('config_key' => 'watermark_path', 'group_name' => 'image', 'config_value' => ''), array('config_key' => 'watermark_position', 'group_name' => 'image', 'config_value' => '0'), array('config_key' => 'ads_in_home', 'group_name' => 'advertisement', 'config_value' => '0'));
$contents = array(array('order' => '0', 'title' => 'Hello [USER.NAME]!', 'seotitle' => 'user-profile-contact', 'description' => "User [EMAIL.SENDER] [EMAIL.FROM], have a message for you: \n\n [EMAIL.SUBJECT] \n\n[EMAIL.BODY]. \n\n Regards!", 'from_email' => core::config('email.notify_email'), 'type' => 'email', 'status' => '1'));
// returns TRUE if some config is saved
$return_conf = Model_Config::config_array($configs);
$return_cont = Model_Content::content_array($contents);
}