本文整理汇总了PHP中Module::is_on方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::is_on方法的具体用法?PHP Module::is_on怎么用?PHP Module::is_on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::is_on方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
/**
* Before action
*/
public function before()
{
parent::before();
Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap.min.css', 'vendor/awesome/css/font-awesome.min.css', 'css/style.css'])->add_scripts(['vendor/jquery-1.11.3.min.js', 'vendor/bootstrap/js/bootstrap.min.js', 'js/app.js']);
$this->cms_modules = Module::get_modules();
if (Module::is_on('cms_shop')) {
$this->cart = new Cart();
$this->template->set_global('cart', $this->cart);
Assets::instance()->add_styles(['vendor/bootstrap/css/bootstrap-select.min.css', 'vendor/slick/slick.css', 'vendor/slick/slick-theme.css'])->add_scripts(['vendor/jquery.maskedinput.js', 'vendor/bootstrap/js/bootstrap-select.min.js', 'vendor/slick/slick.min.js', 'js/cart.js']);
}
$this->template->v_footer = View::factory('frontend/v_footer');
$this->template->v_header = View::factory('frontend/v_header');
}
示例2: change
/**
* Change status on 0 or 1 for field in model.
* @param object $model - model name
* @param string $fieldname - field name for change status (default: enabled)
*/
protected function change($model, $fieldname = 'enabled')
{
$obj = ORM::factory($model, (int) Arr::get($_POST, 'id'));
if ($obj->loaded()) {
$obj->{$fieldname} = !$obj->{$fieldname};
$obj->save();
if (Module::is_on('cms_publications')) {
$obj->change_statuses('publications_pages', $obj->enabled);
}
$this->json['success'] = true;
$this->json['enabled'] = (bool) $obj->{$fieldname};
$this->json['message'] = __('settings.status_changed');
} else {
$this->json['message'] = __('settings.status_failed');
}
}
示例3: action_index
public function action_index()
{
$obj = ORM::factory('Publications_Page')->get_by_slug($this->request->param('slug'));
if (!$obj->loaded()) {
throw new HTTP_Exception_404();
}
// TODO: Работает только для непосредственной рубрики этой статьи
//
if (!$obj->category->enabled) {
throw new HTTP_Exception_404();
}
if (Module::is_on('cms_tags')) {
$tags = $obj->tags->get_slug_name();
}
$this->breadcrumbs[] = ['label' => $obj->category->title, 'url' => $obj->category->slug];
$this->breadcrumbs[] = ['label' => $obj->title];
$this->title = $obj->meta_t;
$this->keywords = $obj->meta_k;
$this->description = $obj->meta_d;
$this->content = View::factory($this->view, ['obj' => $obj])->bind('tags', $tags);
}
示例4:
?>
<?php
if (Module::is_on('cms_blog')) {
echo Widget::load('blog', 'nav');
}
?>
<?php
if (Module::is_on('cms_publications')) {
echo Widget::load('publications', 'nav');
}
?>
<?php
if (Module::is_on('cms_static')) {
//echo Widget::load('static', 'nav');
}
?>
<div id="content-cart-top" style="margin-top: 15px">
<?php
echo View::factory('shop/frontend/cart/v_cart_top');
?>
</div>
</div>
<div class="col-md-9">
<?php
echo Breadcrumb::run($breadcrumbs);
?>
示例5: date
</div>
</div>
<div class="form-group">
<?php
echo TB_Form::label(__('publications.page_date'));
?>
<div class="col-sm-10">
<?php
echo Form::input('date', $obj->date ? $obj->date : date('Y-m-d'), ['class' => 'form-control']);
?>
</div>
</div>
<?php
if (Module::is_on('cms_tags')) {
?>
<div class="form-group">
<?php
echo TB_Form::label(__('tags.tags'));
?>
<div class="col-sm-10">
<?php
echo Form::input('tags', $tags, ['class' => 'form-control']);
?>
</div>
</div>
<?php
}
?>
示例6: action_edit
/**
* Edit
*/
public function action_edit()
{
$this->title = __('publications.page_edit');
$obj = ORM::factory('Publications_Page', $this->request->param('id'));
if (!$obj->loaded()) {
throw new HTTP_Exception_404();
}
if ($this->request->is_post()) {
$tags = Arr::get($_POST, 'tags');
$obj->prepare();
$obj->values($_POST);
try {
$obj->save();
if (Module::is_on('cms_tags')) {
$obj->save_tags($tags, Model_Tag::TYPE_PUBLICATION);
}
Message::success(__('settings.changes_saved'));
$this->_redirect($obj->id);
} catch (ORM_Validation_Exception $e) {
Message::error(__('settings.error_saving'));
$errors = $e->errors('validation');
}
} else {
if (Module::is_on('cms_tags')) {
$tags = $obj->get_tags();
}
}
$this->content = View::factory($this->form, ['obj' => $obj])->bind('tags', $tags)->bind('errors', $errors);
}
示例7: foreach
</h1>
<?php
echo $obj->text;
?>
<p>
<i class="fa fa-calendar fa-fw"></i>
<small><?php
echo Date::format($obj->date, Date::DATE);
?>
</small>
</p>
<!-- Tags -->
<?php
if (Module::is_on('cms_tags') and count($tags) > 0) {
?>
<p>
<span class="badge"><?php
echo __('tags.tags');
?>
:</span>
<?php
foreach ($tags as $slug => $name) {
?>
<span class="label label-tag">
<?php
echo HTML::anchor($slug, '<i class="fa fa-tag fa-fw"></i> ' . $name);
?>
</span>
<?php
示例8:
<div class="col-md-3">
<?php
if (Module::is_on('cms_shop')) {
echo Widget::load('shop', 'recent');
}
?>
<?php
if (Module::is_on('cms_blog')) {
echo Widget::load('blog', 'recent');
}
?>
<?php
if (Module::is_on('cms_publications')) {
echo Widget::load('publications', 'recent');
}
?>
</div>
</div>
</div>
</div>
<?php
echo $v_footer;
?>
<?php