Inheritance: use trait erLhcoreClassDBTrait
 public function __get($var)
 {
     switch ($var) {
         case 'dep_group':
             $this->dep_group = erLhcoreClassModelDepartamentGroup::fetch($this->dep_group_id);
             return $this->dep_group;
             break;
         case 'user':
             $this->user = erLhcoreClassModelUser::fetch($this->user_id);
             return $this->user;
             break;
         default:
             break;
     }
 }
Beispiel #2
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdepartment/editgroup.tpl.php');
$Departament_group = erLhcoreClassModelDepartamentGroup::fetch((int) $Params['user_parameters']['id']);
if (isset($_POST['Cancel_departament'])) {
    erLhcoreClassModule::redirect('department/group');
    exit;
}
if (isset($_POST['Delete_departament'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('department/group');
        exit;
    }
    $Departament_group->removeThis();
    erLhcoreClassModule::redirect('department/group');
    exit;
}
if (isset($_POST['Update_departament']) || isset($_POST['Save_departament'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('department/group');
        exit;
    }
    $Errors = erLhcoreClassDepartament::validateDepartmentGroup($Departament_group);
    if (count($Errors) == 0) {
        $Departament_group->updateThis();
        erLhcoreClassDepartament::validateDepartmentGroupDepartments($Departament_group);
        if (isset($_POST['Save_departament'])) {
            erLhcoreClassModule::redirect('department/group');
            exit;
        } else {
            $tpl->set('updated', true);
Beispiel #3
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhdepartment/group.tpl.php');
$departmentParams = array();
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('department/group');
$pages->items_total = erLhcoreClassModelDepartamentGroup::getCount($departmentParams);
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassModelDepartamentGroup::getList(array_merge($departmentParams, array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC')));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('department/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments')), array('url' => erLhcoreClassDesign::baseurl('department/departments'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments groups')));
    ?>
" <?php 
    echo in_array($departament['id'], $userDepartaments) ? 'checked="checked"' : '';
    ?>
 /><?php 
    echo htmlspecialchars($departament['name']);
    ?>
</label><br>
        	<?php 
}
?>
    	</div>
    </div>
    
    <?php 
$departmentsGroups = erLhcoreClassModelDepartamentGroup::getList(array('limit' => false));
?>
    
    <?php 
if (!empty($departmentsGroups)) {
    ?>
    <div class="col-xs-6">    	           
        <h4><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Departments groups');
    ?>
</h4>
       
        <?php 
    foreach ($departmentsGroups as $departamentGroup) {
        ?>
            <label><input type="checkbox" name="UserDepartamentGroup[]" value="<?php