コード例 #1
0
 function manager()
 {
     if (!$this->manager instanceof Widgets) {
         $this->manager = Widgets::instance();
     }
     return $this->manager;
 }
コード例 #2
0
ファイル: Widgets.php プロジェクト: kostarev/test
 public static function me()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Widgets();
     }
     return self::$instance;
 }
コード例 #3
0
ファイル: widgets.php プロジェクト: ultimateprogramer/cms
 /**
  * Constructor, globally sets region and format
  *
  * @param $region
  * @param $format
  */
 public function __construct($region, $format)
 {
     // Store the region locally
     $this->_region = $region;
     // Store the format locally
     $this->_format = $format;
     // Load the widgets from database
     $this->load();
     // Store the widgets instance
     Widgets::$instance = $this;
 }
コード例 #4
0
	function paginate($arguments = null, $items_per_page = 10, $current_page = 1) {
		if (isset ( $this ) && instance_of ( $this, 'Widgets' )) {
			return parent::paginate ( $arguments, $items_per_page, $current_page );
		} else {
			return Widgets::instance ()->paginate ( $arguments, $items_per_page, $current_page );
		}
	}
コード例 #5
0
ファイル: welcome.php プロジェクト: MenZil-Team/cms
		</div>
	</header>
	<!-- ########## Navbar end ########## -->

	<!-- ########## template / container start ########## -->
	<main id="content" class="welcome-main" role="main">
		<?php 
include Kohana::find_file('views', 'welcome');
?>
	</main>
	<!-- ########## template / container end ########## -->

	<!-- ########## Footer start ########## -->
	<footer class="footer" role="contentinfo">
		<?php 
$footer = Widgets::instance()->render('footer', 'footer');
?>
		<?php 
if ($footer) {
    ?>
			<div class="extra">
				<div class="container">
					<div class="row">
						<?php 
    echo $footer;
    ?>
					</div>
				</div>
			</div>
		<?php 
}
コード例 #6
0
ファイル: body.php プロジェクト: MenZil-Team/cms
" class="<?php 
echo $post->type;
?>
 blog<?php 
if ($post->sticky) {
    echo ' sticky';
}
?>
 <?php 
echo ' blog-' . $post->status;
?>
">

	<?php 
$widget_p_top = Widgets::instance()->render('post_top');
$widget_p_bot = Widgets::instance()->render('post_bottom');
?>

	<?php 
if ($post->taxonomy or $config->use_submitted) {
    ?>
		<div class="row meta">
			<?php 
    if ($config->use_submitted) {
        ?>
				<div class="col-md-7">
					<span class="author">
						<?php 
        echo HTML::anchor($post->user->url, User::getAvatar($post->user));
        ?>
						<?php 
コード例 #7
0
<?php

$top = Widgets::instance()->render('top');
$bottom = Widgets::instance()->render('bottom');
$content_top = Widgets::instance()->render('content_top', 'html');
$content_bottom = Widgets::instance()->render('content_top', 'html');
?>
<div class="container">
	<?php 
if ($messages) {
    ?>
		<!-- ########## Messages start ########## -->
		<div class="row">
			<div id="messages" class="messages col-md-8 col-md-offset-2">
				<?php 
    echo $messages;
    ?>
			</div>
		</div>
		<!-- ########## Messages end ########## -->
	<?php 
}
?>

	<?php 
if ($top and !empty($top)) {
    ?>
		<!-- ########## Top start ########## -->
		<div class="row">
			<div class="col-md-12">
				<?php 
コード例 #8
0
ファイル: template.php プロジェクト: ultimateprogramer/cms
 /**
  * Loads the template View object, if it is direct request
  *
  * @return  void
  * @throws  Http_Exception_415  If none of the accept-types are supported
  */
 public function before()
 {
     // Execute parent::before first
     parent::before();
     if ($this->bare == FALSE) {
         // Load the config
         $this->_config = Config::load('site');
         if (Kohana::$profiling) {
             // Start a new benchmark token
             $this->_benchmark = Profiler::start('Gleez', ucfirst($this->request->controller()) . ' Controller');
         }
         // Test whether the current request is command line request
         if (Kohana::$is_cli) {
             $this->_ajax = FALSE;
             $this->auto_render = FALSE;
         }
         // Test whether the current request is the first request
         if (!$this->request->is_initial()) {
             $this->_internal = TRUE;
             $this->auto_render = FALSE;
         }
         // Test whether the current request is ajax request
         if ($this->request->is_ajax()) {
             $this->_ajax = TRUE;
             $this->auto_render = FALSE;
         }
         // Test whether the current request is jquery mobile request. ugly hack
         if (Request::is_mobile() and $this->_config->get('mobile_theme', FALSE)) {
             $this->_ajax = FALSE;
             $this->auto_render = TRUE;
         }
         // Test whether the current request is datatables request
         if (Request::is_datatables()) {
             $this->_ajax = TRUE;
             $this->auto_render = FALSE;
         }
         $this->response->headers('X-Powered-By', Gleez::getVersion(TRUE, TRUE) . ' (' . Gleez::CODENAME . ')');
         $this->_auth = Auth::instance();
         // Get desired response formats
         $accept_types = Request::accept_type();
         $accept_types = Arr::extract($accept_types, array_keys($this->_accept_formats));
         // Set response format to first matched element
         $this->_response_format = $this->request->headers()->preferred_accept(array_keys($this->_accept_formats));
         $site_name = Template::getSiteName();
         $url = URL::site(NULL, TRUE);
         View::bind_global('site_name', $site_name);
         View::bind_global('site_url', $url);
     }
     if ($this->auto_render && $this->bare == FALSE) {
         // Throw exception if none of the accept-types are supported
         if (!($accept_types = array_filter($accept_types))) {
             throw new Http_Exception_415('Unsupported accept-type', 415);
         }
         // Initiate a Format instance
         $this->_format = Format::instance();
         // Load the template
         $this->template = View::factory($this->template);
         $this->title_separator = $this->_config->get('title_separator', ' | ');
         $this->_widgets = Widgets::instance();
         $this->template->_admin = Theme::$is_admin;
         // Set the destination & redirect url
         $this->_desti = array('destination' => $this->request->uri());
         $this->redirect = $this->request->query('destination') !== NULL ? $this->request->query('destination') : array();
         // Bind the generic page variables
         $this->template->set('site_name', Template::getSiteName())->set('site_slogan', $this->_config->get('site_slogan', __('Innovate IT')))->set('site_url', URL::site(NULL, TRUE))->set('site_logo', $this->_config->get('site_logo', FALSE))->set('sidebar_left', array())->set('sidebar_right', array())->set('column_class', '')->set('main_column', 12)->set('head_title', $this->title)->set('title', $this->title)->set('subtitle', $this->subtitle)->set('icon', $this->icon)->set('schemaType', $this->schemaType)->set('front', FALSE)->set('mission', FALSE)->set('tabs', FALSE)->set('subtabs', FALSE)->set('actions', FALSE)->set('_user', $this->_auth->get_user())->bind('datatables', $this->_datatables);
         // Page Title
         $this->title = ucwords($this->request->controller());
         // Assign the default css files
         $this->_set_default_css();
         // Assign the default js files
         $this->_set_default_js();
         // Set default server headers
         $this->_set_default_server_headers();
         // Set default meta data and media
         $this->_set_default_meta_links();
         $this->_set_default_meta_tags();
         /**
          * Make your view template available to all your other views
          * so easily you could access template variables
          */
         View::bind_global('template', $this->template);
     }
     if (Kohana::$environment === Kohana::DEVELOPMENT) {
         Log::debug('Executing Controller [:controller] action [:action]', array(':controller' => $this->request->controller(), ':action' => $this->request->action()));
     }
 }
コード例 #9
0
 function configure_widgets_default_submit()
 {
     ajx_current("empty");
     $widgets_data = array_var($_POST, 'widgets');
     try {
         DB::beginWork();
         foreach ($widgets_data as $name => $data) {
             $widget = Widgets::instance()->findOne(array('conditions' => array('name = ?', $name)));
             if (!$widget instanceof Widget) {
                 continue;
             }
             $widget->setDefaultOrder($data['order']);
             $widget->setDefaultSection($data['section']);
             $widget->save();
             if (isset($data['options']) && is_array($data['options'])) {
                 foreach ($data['options'] as $opt_name => $opt_val) {
                     $contact_widget_option = ContactWidgetOptions::instance()->findOne(array('conditions' => array('contact_id=0 AND widget_name=? AND `option`=?', $name, $opt_name)));
                     if (!$contact_widget_option instanceof ContactWidgetOption) {
                         continue;
                     }
                     $contact_widget_option->setValue($opt_val);
                     $contact_widget_option->save();
                 }
             }
         }
         DB::commit();
         evt_add('reload tab panel', 'overview-panel');
         ajx_current("back");
     } catch (Exception $e) {
         flash_error($e->getMessage());
         DB::rollback();
     }
 }
コード例 #10
0
ファイル: post.php プロジェクト: MenZil-Team/cms
 /**
  * Display widgets inline of post body
  *
  * @param   string  $content  The post content
  * @param   string  $region   The widget's region name
  * @return  string  The replaced content with widgets
  * @uses    Widgets::render
  */
 public static function widgets($content, $region = 'post_inline')
 {
     // Save some cpu cycles, when the content is empty
     if ($content == NULL or empty($content)) {
         return $content;
     }
     // We found special tag, so don't set widgets!
     // Just return the content
     if (strpos($content, self::NO_WIDGETS_TAG) !== FALSE) {
         return $content;
     }
     $poses = array();
     $lastpos = -1;
     $repchar = "<p";
     // if we didn't find a p tag, try br tag
     if (strpos($content, "<p") === FALSE) {
         $repchar = "<br";
     }
     while (strpos($content, $repchar, $lastpos + 1) !== FALSE) {
         $lastpos = strpos($content, $repchar, $lastpos + 1);
         $poses[] = $lastpos;
     }
     // Cut the doc in half, so the widgets don't go past the end of the article.
     $pickme = $poses[ceil(sizeof($poses) / 2) - 1];
     $widgets = Widgets::instance()->render($region);
     $replacewith = $widgets ? '<div id="' . $region . '" class="clear-block">' . $widgets . '</div>' : NULL;
     $content = substr_replace($content, $replacewith . $repchar, $pickme, 2);
     // save some memory
     unset($poses, $lastpos, $repchar, $half, $pickme, $widgets, $replacewith);
     return $content;
 }
コード例 #11
0
ファイル: dashboard.php プロジェクト: MenZil-Team/cms
 public function action_index()
 {
     $this->title = __('Administer');
     $view = View::factory('admin/dashboard')->set('widgets', Widgets::instance()->render('dashboard'));
     $this->response->body($view);
 }
コード例 #12
0
 static function renderSection($name)
 {
     $widgetsToRender = array();
     self::$widgets = Widgets::instance()->findAll(array("conditions" => " plugin_id = 0 OR plugin_id IS NULL OR plugin_id IN ( SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_activated > 0 AND is_installed > 0 )", "order" => "default_order", "order_dir" => "DESC"));
     // If exists an instance of cw for this section, render the widgets with the options overriden
     foreach (self::$widgets as $w) {
         /* @var $w Widget */
         if ($cw = ContactWidgets::instance()->findById(array('contact_id' => logged_user()->getId(), 'widget_name' => $w->getName()))) {
             if ($cw->getSection() == $name) {
                 $w->setOptions($cw->getOptions());
                 $w->setDefaultOrder($cw->getOrder());
                 $widgetsToRender[] = $w;
             }
         } elseif ($w->getDefaultSection() == $name) {
             $widgetsToRender[] = $w;
         }
     }
     usort($widgetsToRender, "widget_sort");
     foreach ($widgetsToRender as $k => $w) {
         $w->execute();
     }
 }
コード例 #13
0
 function configure_widgets()
 {
     $widgets = Widgets::instance()->findAll(array("conditions" => " plugin_id = 0 OR plugin_id IS NULL OR plugin_id IN ( SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_activated > 0 AND is_installed > 0 )", "order" => "default_order", "order_dir" => "ASC"));
     $widgets_info = array();
     foreach ($widgets as $widget) {
         $widgets_info[] = $widget->getContactWidgetSettings(logged_user());
     }
     $ordered = array();
     foreach ($widgets_info as $info) {
         $ord = isset($info['order']) ? $info['order'] : $info['default_order'];
         $key = str_pad($ord, 4, '0', STR_PAD_LEFT) . '_' . $info['name'];
         $ordered[$key] = $info;
     }
     ksort($ordered);
     tpl_assign('widgets_info', array_values($ordered));
 }
コード例 #14
0
	function manager() {
		if (! ($this->manager instanceof Widgets))
			$this->manager = Widgets::instance ();
		return $this->manager;
	}
コード例 #15
0
<?php

$ws_dim = Dimensions::findByCode('workspaces');
$row_cls = "";
$add_button_text = count($data_ws) > 0 ? lang('add new workspace') : lang('add your first workspace');
$no_objects_text = count($data_ws) > 0 ? '' : lang('you have no workspaces yet');
$ws_widget = Widgets::instance()->findById('workspaces');
$section = $ws_widget instanceof Widget && in_array($ws_widget->getDefaultSection(), array('left', 'right')) ? $ws_widget->getDefaultSection() : 'right';
?>

<div class="ws-widget widget">

	<div class="widget-header" onclick="og.dashExpand('<?php 
echo $genid;
?>
');">
		<div class="widget-title"><?php 
echo $ws_dim->getName();
?>
</div>
		<div class="dash-expander ico-dash-expanded" id="<?php 
echo $genid;
?>
expander"></div>
	</div>
	
	<div class="widget-body" id="<?php 
echo $genid;
?>
_widget_body" >