Ejemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     if (!Admin_Libraries_Admin::isLoged()) {
         header('location: ' . SITE_ROOT_URI . '/admin/auth/login/');
         exit;
     }
     $this->user = Admin_Libraries_Admin::getLogedUser();
     $this->user->loadRole();
 }
Ejemplo n.º 2
0
Archivo: log.php Proyecto: vukasins/ocp
 /**
  *
  * @param string $action
  * @param string $content
  * @return Libraries_Db_Mysql_Model
  */
 public function logAction($action, $content)
 {
     $this->fifo();
     $log = new Libraries_Db_Mysql_Model('sys_log');
     $log->id_adm_user = Admin_Libraries_Admin::getLogedUser()->id;
     $log->action = $action;
     $log->content = $content;
     $log->create_date = time();
     $log->save();
     return $log;
 }
Ejemplo n.º 3
0
 public function index()
 {
     $content = Libraries_View::getInstance()->setModule('admin')->load('404');
     Libraries_Layout::getInstance()->setTheme('admin');
     if (Admin_Libraries_Admin::getLogedUser()->id > 0) {
         Libraries_Layout::getInstance()->setLayout('admin');
     } else {
         Libraries_Layout::getInstance()->setLayout('error');
     }
     Libraries_Layout::getInstance()->setRegionContent('content', $content);
     Libraries_Layout::getInstance()->render();
 }
Ejemplo n.º 4
0
 public function prepareActionFiles()
 {
     $user = Admin_Libraries_Admin::getLogedUser();
     $user->loadRole();
     foreach ($this->action_files as $action_file) {
         $json = file_get_contents($action_file);
         $action_data = json_decode($json);
         foreach ($action_data as $action_group) {
             if (!array_key_exists($action_group->group, $this->actions)) {
                 $this->actions[$action_group->group] = array();
             }
             if ($action_group->level == $user->role->safe_title) {
                 $this->actions[$action_group->group][] = $action_group;
             }
             if (empty($this->actions[$action_group->group])) {
                 unset($this->actions[$action_group->group]);
             }
         }
     }
     return $this;
 }
Ejemplo n.º 5
0
echo SITE_ROOT_URI . '/crud/modify/' . $sys_object->id . '/0';
?>
" class="btn btn-primary create-new"><i class="fa fa-plus"></i> <?php 
echo __('Create new');
?>
</a>
					<?php 
if (!$is_ajax_call) {
    ?>
						<a class="btn btn-info search" href="#"><i class="fa fa-search"></i> <?php 
    echo __('Search');
    ?>
</a>
						
						<?php 
    if (Admin_Libraries_Admin::getLogedUser()->loadRole()->role->safe_title == 'administrator') {
        ?>
							<a class="btn <?php 
        echo isset($_SESSION['trash']) && $_SESSION['trash'] == 1 ? 'btn-success' : 'btn-default';
        ?>
 trash" href="<?php 
        echo SITE_ROOT_URI . '/crud/trash/';
        ?>
"><i class="fa fa-trash-o"></i> <?php 
        echo __('Trash');
        ?>
: <?php 
        echo isset($_SESSION['trash']) && $_SESSION['trash'] == 1 ? __('on') : __('off');
        ?>
</a>
						<?php 
Ejemplo n.º 6
0
 public function logout()
 {
     Admin_Libraries_Admin::logout();
     header('location:' . SITE_ROOT_URI . '/admin/');
     exit;
 }
Ejemplo n.º 7
0
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">
					<span class="ocp-logo">OCP3</span>
					<span class="site-url">Omnicom Content Platform <em>(www.ocp3.com)</em></span>
				</a>
            </div>
            
            <?php 
$user = Admin_Libraries_Admin::getLogedUser();
$user->loadRole();
?>
            <!-- Top Menu Items -->
            <ul class="nav navbar-right top-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> <?php 
echo $user->username;
?>
<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="<?php 
echo SITE_ROOT_URI . '/admin/profile/';
?>
"><i class="fa fa-fw fa-user"></i> Profile</a>
Ejemplo n.º 8
0
 public function modify($sys_object_id, $row_id = '', $subform_relation_id = null, $subform_relation_value = null)
 {
     $sys_object = new Crud_Models_Object();
     $sys_object->load(intval($sys_object_id));
     $sys_object->loadFieldsForObject();
     if ($sys_object->is_system == 1 && $this->user->role->safe_title != 'administrator') {
         echo '<script>window.location="' . SITE_ROOT_URI . '/admin/error/' . '"</script>';
         //header('location: ' . SITE_ROOT_URI . '/admin/error/');
         exit;
     }
     if (!$this->user->role->canExecuteAction('can_view_' . $sys_object->table_name)) {
         echo '<script>window.location="' . SITE_ROOT_URI . '/admin/error/' . '"</script>';
         //header('location: ' . SITE_ROOT_URI . '/admin/error/');
         exit;
     }
     if ($sys_object->custom_crud_class != '' && new $sys_object->custom_crud_class() instanceof Crud_Interfaces_Crud) {
         echo call_user_func(array(new $sys_object->custom_crud_class(), 'modify'), $sys_object_id, $row_id);
     } else {
         $object_data = new Libraries_Db_Mysql_Model($sys_object->table_name);
         $subforms = array();
         if ($row_id != '') {
             $object_data->load(intval($row_id));
             $where = array();
             $where[] = array('AND', 'id_sys_object_parent', '=', $sys_object->id);
             $subform = new Crud_Models_Subform();
             $subforms = $subform->search($where);
         }
         if (isset($_GET['clone']) && $_GET['clone'] == 1) {
             $object_data->id = null;
         }
         $subform_relation = null;
         $subform_relation_field = null;
         if ($subform_relation_id) {
             $subform_relation = new Crud_Models_Subform();
             $subform_relation->load($subform_relation_id);
             $subform_relation_field = new Crud_Models_Field();
             $subform_relation_field->load($subform_relation->id_sys_field);
         }
         Libraries_Event::trigger('beforeFormOpen', $sys_object, $object_data);
         $user = Admin_Libraries_Admin::getLogedUser()->loadRole();
         Libraries_View::getInstance()->sys_object = $sys_object;
         Libraries_View::getInstance()->object_data = $object_data;
         Libraries_View::getInstance()->subforms = $subforms;
         Libraries_View::getInstance()->subform_relation = $subform_relation;
         Libraries_View::getInstance()->subform_relation_field = $subform_relation_field;
         Libraries_View::getInstance()->subform_relation_value = $subform_relation_value;
         Libraries_View::getInstance()->user = $user;
         $content = Libraries_View::getInstance()->setModule('crud')->load('row');
         echo $content;
     }
 }