Esempio n. 1
0
 public function beforeRoute()
 {
     // check, if we have admin menu
     $id = \Admin\Models\Settings::fetch()->get('admin_menu_id');
     if (empty($id)) {
         // no admin menu => generate new
         \Dsc\Request::internal('Admin\\Controllers\\System->rebuildAdminMenuCode');
     }
 }
Esempio n. 2
0
 public function rebuilAdminMenuCode()
 {
     $settings = \Admin\Models\Settings::fetch();
     $root = new \Admin\Models\Nav\Primary();
     // delete all admin menu items, if there are any
     \Admin\Models\Nav\Primary::collection()->remove(array('type' => 'admin.nav'));
     $root->type = 'admin.nav';
     $root->{'is_root'} = true;
     $root->title = 'Admin Primary Navigation';
     $root->tree = new \MongoId();
     $root->save();
     $root->tree = $root->id;
     $root->save();
     // save current admin menu id
     $settings->{'admin_menu_id'} = (string) $root->id;
     $settings->save();
     /**
      * Languages Menu Items
      */
     $parent = new \Admin\Models\Nav\Primary();
     $parent->insert(array('type' => 'admin.nav', 'priority' => 90, 'title' => 'Translations', 'icon' => 'fa fa-language', 'is_root' => false, 'tree' => $root->id, 'base' => '/admin/language'));
     $children = array(array('title' => 'Languages', 'route' => './admin/languages', 'icon' => 'fa fa-list'));
     $parent->addChildren($children, $root);
     \Dsc\System::addMessage('Translations added its admin menu items.');
     /**
      * System Nav
      */
     $navigation = new \Admin\Models\Nav\Primary();
     $navigation->insert(array('type' => 'admin.nav', 'priority' => 100, 'title' => 'Navigation', 'icon' => 'fa fa-tasks', 'is_root' => false, 'tree' => $root->id));
     $children = array(array('title' => 'Menus', 'route' => './admin/menus', 'icon' => 'fa fa-list'));
     $navigation->addChildren($children);
     $system = new \Admin\Models\Nav\Primary();
     $system->insert(array('type' => 'admin.nav', 'priority' => 1000, 'title' => 'System', 'icon' => 'fa fa-cogs', 'is_root' => false, 'tree' => $root->id));
     $children = array(array('title' => 'Settings', 'route' => './admin/settings', 'icon' => 'fa fa-cogs'), array('title' => 'Rebuild Menu', 'route' => './admin/system/rebuildAdminMenu', 'icon' => 'fa fa-retweet'), array('title' => 'Queue', 'route' => 'javascript:void(0);', 'icon' => 'fa fa-refresh'), array('title' => 'Cron', 'route' => './admin/cron', 'icon' => 'fa fa-clock-o'), array('title' => 'Logs', 'route' => './admin/logs', 'icon' => 'fa fa-list'), array('title' => 'Cache', 'route' => 'javascript:void(0);', 'icon' => 'fa fa-star'), array('title' => 'Diagnostics', 'route' => './admin/system/diagnostics', 'icon' => 'fa fa-heart'), array('title' => 'Trash', 'route' => './admin/trash/items', 'icon' => 'fa fa-trash'));
     $system->addChildren($children);
     // Find the Queue Item
     $queue_item = (new \Admin\Models\Nav\Primary())->load(array('type' => 'admin.nav', 'parent' => $system->id, 'title' => 'Queue'));
     // add its children
     if (!empty($queue_item->id)) {
         $system_children = array(array('title' => 'Tasks', 'route' => './admin/queue/tasks', 'icon' => 'fa fa-link'), array('title' => 'Archive', 'route' => './admin/queue/archives', 'icon' => 'fa fa-gift'));
         $queue_item->addChildren($system_children);
     }
     // Find the Cache Item
     $cache_item = (new \Admin\Models\Nav\Primary())->load(array('type' => 'admin.nav', 'parent' => $system->id, 'title' => 'Cache'));
     // add its children
     if (!empty($cache_item->id)) {
         $system_children = array(array('title' => 'OpCache', 'route' => './admin/cache/opcache', 'icon' => 'fa fa-forward'), array('title' => 'APCu', 'route' => './admin/cache/apcu', 'icon' => 'fa fa-eraser'));
         $cache_item->addChildren($system_children);
     }
     \Dsc\System::instance()->addMessage('System added its admin menu items');
     $result = \Dsc\System::instance()->trigger('onSystemRebuildMenu', array('model' => new \Admin\Models\Nav\Primary(), 'root' => $root->id));
     \Dsc\System::instance()->addMessage('Menu rebuilt', 'notice');
 }
Esempio n. 3
0
 public static function trackActor($email, $action, $properties = array())
 {
     if (class_exists('\\Activity\\Models\\Actions')) {
         \Activity\Models\Actions::trackActor($email, $action, $properties);
     }
     if (class_exists('\\Admin\\Models\\Settings') && class_exists('\\KM')) {
         $settings = \Admin\Models\Settings::fetch();
         if ($settings->enabledIntegration('kissmetrics') && $settings->{'integration.kissmetrics.key'}) {
             \KM::init($settings->{'integration.kissmetrics.key'});
             \KM::identify($email);
             \KM::record($action, $properties);
         }
     }
     return null;
 }
Esempio n. 4
0
 public function beforeRoute()
 {
     parent::beforeRoute();
     $settings = \Admin\Models\Settings::fetch();
     if (empty($settings->admin_menu_id)) {
         $this->session->set('rebuild-menu.redirect', '/admin');
         return $this->app->reroute('/admin/system/rebuildAdminMenu');
     }
     if (class_exists('\\Mailer\\Factory')) {
         $mailer_settings = \Mailer\Models\Settings::fetch();
         if (!$mailer_settings->emails_registered || date('Y-m-d', time()) > date('Y-m-d', $mailer_settings->emails_registered)) {
             $result = \Dsc\System::instance()->trigger('onSystemRegisterEmails');
             $mailer_settings->{'emails_registered'} = time();
             $mailer_settings->save();
         }
     }
 }
Esempio n. 5
0
    <!-- NAVIGATION : This navigation is also responsive

	To make this navigation dynamic please make sure to link the node
	(the reference to the nav > ul) after page load. Or the navigation
	will not initialize.
	-->
    <nav class="primary-nav">
        <!-- NOTE: Notice the gaps after each icon usage <i></i>..
		Please note that these links work a bit different than
		traditional hre="" links. See documentation for details.
		-->
        <?php 
$pieces = explode('?', \Dsc\Pagination::checkRoute(str_replace($BASE, '', $URI)));
$current = $pieces[0];
$list = (new \Admin\Models\Nav\Primary())->setState('filter.root', false)->setState('filter.tree', \Admin\Models\Settings::fetch()->get('admin_menu_id'))->setState('order_clause', array('tree' => 1, 'lft' => 1))->getItems();
// push the default to the beginning of the list
array_unshift($list, new \Admin\Models\Nav\Primary(array('route' => './admin', 'title' => 'Dashboard', 'icon' => 'fa-home', 'depth' => 2)));
?>
        
        <ul>
        <?php 
foreach ($list as $key => $item) {
    if (!($hasAccess = \Dsc\System::instance()->get('acl')->isAllowed($identity->role, $item->route, '*'))) {
        continue;
    }
    $class = !empty($item->class) ? $item->class : 'menu-item';
    $selected = $current == $item->route || !empty($item->base) && strpos($current, $item->base . '/') !== false || \Dsc\String::inStrings(\Dsc\ArrayHelper::getColumn($item->getDescendants(), 'route'), $current);
    if ($selected || $current == str_replace('./', '/', $item->route)) {
        $class .= " active open";
    }
Esempio n. 6
0
<?php

$item->url = './shop/product/' . $item->{'slug'};
$images = $item->images();
$variantsInStock = $item->variantsInStock();
$variant_1 = current($variantsInStock);
$wishlist_state = \Shop\Models\Wishlists::hasAddedVariant($variant_1['id'], (string) $this->auth->getIdentity()->id) ? 'false' : 'true';
$settings = \Admin\Models\Settings::fetch();
$is_kissmetrics = $settings->enabledIntegration('kissmetrics');
?>

<script>

Shop.toggleWishlist = function(state) {
	var new_html = '';
	if( state == true ){ // enable adding to wishilist
		new_html = "<a class='add-to-wishlist' href='javascript:void(0);'><i class='glyphicon glyphicon-heart'></i> Add to wishlist</a>";
	} else {
		new_html = "<a href='javascript:void(0);'><i class='glyphicon glyphicon-heart'></i> In your wishlist</a>";
	}
	jQuery( '.add-to-wishlist-container' ).html( new_html );
}

jQuery(document).ready(function(){
   jQuery('.product-details').on('click', '.add-to-wishlist', function(ev){
       ev.preventDefault();
       var el = jQuery(this);
       var variant_id = el.closest('form').find('.variant_id').val();
       if (variant_id) {
	        var request = jQuery.ajax({
	            type: 'get',