function merchant_is_logged_in()
{
    $tool =& \Clips\get_clips_tool();
    $merchant = $tool->model('merchant');
    \Clips\log('The id of user is {0}', array($merchant->getCurrentMerchantID()));
    return !!$merchant->getCurrentMerchantID();
}
 public function active()
 {
     $controller = \Clips\context('controller');
     if ($controller) {
         $query = $controller->getMovieQuery();
         $values = $query->{$this->mode};
         \Clips\log('The values is ', array($values, $this->mode_value));
         return array_search(urlencode($this->mode_value), $values) !== false;
     }
     return false;
 }
Example #3
0
 public function init()
 {
     if (\extension_loaded('imagick')) {
         $this->type = 'imagick';
     } else {
         if (\extension_loaded('gd')) {
             $this->type = 'gd';
         }
     }
     \Clips\log('Using php extension {0} as image processing library.', array($this->type));
 }
function _smarty_block_navigation_tree_node($action, $indent, $template, $repeat, $li_class = array())
{
    $tool =& Clips\get_clips_tool();
    $security = $tool->load_class('securityEngine', true);
    $result = $security->test($action);
    if ($result) {
        // If rejected this action
        Clips\log('Rejected action [{0}] for reasion [{1}]', array($action->label(), $result[0]->reason, $action));
        return '';
    }
    $f = true;
    // Start the li
    smarty_block_li(array(), '', $template, $f);
    // Start the action
    smarty_block_action(array(), '', $template, $f);
    // Close the action
    $a = smarty_block_action(array('action' => $action), '', $template, $repeat);
    $children = $action->children();
    if ($children) {
        $class[] = 'treeview';
        $sub = array();
        smarty_block_ul(array('class' => array('treeview', 'sub-navi')), '', $template, $f);
        foreach ($children as $c) {
            $sub[] = _smarty_block_navigation_tree_node($c, $indent . "\t\t", $template, $repeat, $li_class);
        }
        $a .= "\n{$indent}\t" . smarty_block_ul(array('class' => array('sub-navi', 'treeview-menu')), implode("", $sub), $template, $repeat);
    }
    $class = array();
    if ($li_class) {
        if (!is_array($li_class)) {
            $li_class = array($li_class);
        }
        $class = $li_class;
    }
    if ($action->active()) {
        $class[] = 'active';
    }
    if ($action->type() == 'header') {
        $class[] = 'header';
    }
    // Close the li
    return "\n{$indent}" . smarty_block_li(array('class' => $class), $a, $template, $repeat);
}