public function mod()
 {
     $id_trans = Get::req('id_trans', DOTY_INT, 0);
     if (isset($_POST['undo'])) {
         Util::jump_to('index.php?r=alms/transaction/show');
     }
     if (isset($_POST['save']) || isset($_POST['not_paid'])) {
         $product_to_activate = Get::req('product', DOTY_MIXED, array());
         $id_user = Get::req('id_user', DOTY_MIXED, 0);
         if ($this->model->saveTransaction($product_to_activate, $id_trans, $id_user)) {
             $this->model->controlActivation($id_trans, isset($_POST['not_paid']));
             Util::jump_to('index.php?r=alms/transaction/show&res=ok');
         }
         Util::jump_to('index.php?r=alms/transaction/show&res=err');
     }
     $transaction_info = $this->model->getTransactionInfo($id_trans);
     $user_info = $this->acl_man->getUser($transaction_info['id_user'], false);
     $user_info[ACL_INFO_USERID] = $this->acl_man->relativeId($user_info[ACL_INFO_USERID]);
     require_once _base_ . '/lib/lib.table.php';
     $tb = new Table(false, Lang::t('_DETAILS', 'transaction'), Lang::t('_DETAILS', 'transaction'));
     $ts = array('', '', 'min-cell', 'image');
     $th = array(Lang::t('_CODE', 'transaction'), Lang::t('_NAME', 'transaction'), Lang::t('_PRICE', 'transaction'), Lang::t('_MARK_AS_PAID', 'transaction'));
     $tb->setColsStyle($ts);
     $tb->addHead($th);
     foreach ($transaction_info['product'] as $product_info) {
         $tb->addBody(array($product_info['code'], $product_info['name'], $product_info['price'], Form::getInputCheckbox('product_' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'], 'product[' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'] . ']', 1, $product_info['activated'], $product_info['activated'] ? ' disabled="disabled"' : '')));
     }
     $this->render('mod', array('transaction_info' => $transaction_info, 'user_info' => $user_info, 'tb' => $tb, 'id_trans' => $id_trans));
 }
Ejemplo n.º 2
0
 /**
  * @param 	string	contains the group selected
  *
  * @return 	string 	contains the displayable information for a selected group
  */
 function getPageWithElement($group_selected)
 {
     if ($group_selected != 'user_manager') {
         return '';
     }
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('user_managment', 'framework');
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size\r\n\t\tFROM " . $this->_table . "\r\n\t\tWHERE pack = 'log_option' AND\r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             case "register_type":
                 //on off
                 $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF'), $var_name . '_self', 'option[' . $var_name . ']', 'self', $var_value == 'self') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF_OPTIN'), $var_name . '_self_optin', 'option[' . $var_name . ']', 'self_optin', $var_value == 'self_optin') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_MODERATE'), $var_name . '_moderate', 'option[' . $var_name . ']', 'moderate', $var_value == 'moderate') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_ADMIN'), $var_name . '_admin', 'option[' . $var_name . ']', 'admin', $var_value == 'admin') . Form::getCloseCombo();
                 break;
             case "register_tree":
                 $register_possible_option = array('off' => $lang->def('_DONT_USE_TREE_REGISTRATION'), 'manual_insert' => $lang->def('_USE_WITH_MANUALEINSERT'), 'selection' => $lang->def('_USE_WITH_SELECTION'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $register_possible_option, $var_value);
                 break;
             case "field_tree":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields(false);
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value);
                 break;
             case "save_log_attempt":
                 //on off
                 $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_ALL'), $var_name . '_all', 'option[' . $var_name . ']', 'all', $var_value == 'all') . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_AFTER_MAX'), $var_name . '_after_max', 'option[' . $var_name . ']', 'after_max', $var_value == 'after_max') . Form::getLineRadio('', 'label_bold', $lang->def('_NO'), $var_name . '_no', 'option[' . $var_name . ']', 'no', $var_value == 'no') . Form::getCloseCombo();
                 break;
             case "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . ' ' . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name)), 'label_bold') . Form::closeFormLine();
                 break;
                 //uncrypted password
             //uncrypted password
             case "password":
                 $html .= Form::getPassword($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
                 break;
                 //string or int
             //string or int
             default:
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
         }
     }
     return $html;
 }
Ejemplo n.º 3
0
<br />

<?php 
$title = array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), 'index.php?r=' . $base_link_edition . '/show&id_course=' . $model->getIdCourse() => Lang::t('_EDITIONS', 'course'), Lang::t('_ADD', 'course'));
echo getTitleArea($title);
?>

<div class="std_block">

<?php 
echo Form::openForm('add_edition_form', 'index.php?r=' . $base_link_edition . '/add&amp;id_course=' . $model->getIdCourse()) . Form::openElementSpace() . Form::getTextfield(Lang::t('_CODE', 'course'), 'code', 'code', 255, $course_info['code']) . Form::getTextfield(Lang::t('_NAME', 'course'), 'name', 'name', 255, $course_info['name']) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'description', 'description', $course_info['description']) . Form::getDropdown(Lang::t('_STATUS', 'course'), 'status', 'status', $model->getStatusForDropdown()) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_par', 'max_par', 255) . Form::getTextfield(Lang::t('_MIN_NUM_SUBSCRIBE', 'course'), 'min_par', 'min_par', 255) . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'price', 'price', 255) . Form::getDatefield(Lang::t('_DATE_BEGIN', 'course'), 'date_begin', 'date_begin') . Form::getDatefield(Lang::t('_DATE_END', 'course'), 'date_end', 'date_end') . '<div class="form_line_l">' . '<p><label for="overbooking" class="floating">' . Lang::t('_ALLOW_OVERBOOKING', 'course') . '</label></p>' . Form::getInputCheckbox('overbooking', 'overbooking', 1, false, false) . '</div>' . '<div class="form_line_l">' . '<p><label for="overbooking" class="floating">' . Lang::t('_SUBSCRIPTION_OPEN', 'course') . '</label></p>' . Form::getInputCheckbox('can_subscribe', 'can_subscribe', 1, false, false) . '</div>' . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course'), 'sub_date_begin', 'sub_date_begin') . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course'), 'sub_date_end', 'sub_date_end') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('ins', 'ins', Lang::t('_SAVE', 'course')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'course')) . Form::closeButtonSpace() . Form::closeForm();
?>

</div>
Ejemplo n.º 4
0
function modTransaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    $course_man = new Man_Course();
    $date_man = new DateManager();
    $id_transaction = Get::req('id', DOTY_INT, 0);
    $transaction_info = $man_transaction->getTransactionInfo($id_transaction);
    if (isset($_POST['update'])) {
        $payment_status = Get::req('payment_status', DOTY_INT, 0);
        $course_status = Get::req('course_status', DOTY_INT, 0);
        $note = Get::req('note', DOTY_MIXED, '');
        if ($man_transaction->updateTransaction($id_transaction, $payment_status, $course_status, $note)) {
            if (isset($_POST['confirm'])) {
                $activations = array();
                foreach ($_POST['confirm'] as $id => $n) {
                    list($id_course, $id_date) = explode('_', $id);
                    if ($id_date != 0) {
                        $activations[$id_course]['dates'][$id_date] = $id_date;
                    } else {
                        $activations[$id_course] = $id_course;
                    }
                }
                if ($man_transaction->activateCourses($id_transaction, $transaction_info['id_user'], $activations)) {
                    Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
                }
            } else {
                Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
            }
        }
        Util::jump_to('index.php?modname=transaction&op=transaction&res=err_up');
    }
    $array_title = array('index.php?modname=transaction&amp;op=transaction' => $lang->def('_TRANSACTION'), $lang->def('_MOD_TRANSACTION'));
    //Status info & note
    $array_payment_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
    $array_course_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
    cout(getTitleArea($array_title) . '<div class="std_block">' . Form::openForm('transaction_info', 'index.php?modname=transaction&amp;op=mod&amp;id=' . $id_transaction) . Form::openElementSpace() . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $transaction_info['payment_status']) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $transaction_info['course_status']) . Form::getSimpleTextarea($lang->def('_NOTES'), 'note', 'note', $transaction_info['note']) . Form::closeElementSpace());
    //User info
    $user_info = $acl_man->getUser($transaction_info['id_user'], false);
    $tb_user = new Table(0, $lang->def('_USER_INFO'), $lang->def('_USER_INFO'));
    $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'));
    $type_h = array('', '', '', '');
    $tb_user->setColsStyle($type_h);
    $tb_user->addHead($cont_h);
    $tb_user->addBody(array($acl_man->relativeId($user_info[ACL_INFO_USERID]), $user_info[ACL_INFO_FIRSTNAME], $user_info[ACL_INFO_LASTNAME], $user_info[ACL_INFO_EMAIL]));
    cout('<br />' . $tb_user->getTable());
    //Payment info if we need it
    //Product info
    $tb_product = new Table(0, $lang->def('_PRODUCT_INFO'), $lang->def('_PRODUCT_INFO'));
    $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DATE_BEGIN'), $lang->def('_DATE_END'), $lang->def('_COURSE_PRIZE'), $lang->def('_CONFIRM_COURSE'));
    $type_h = array('', '', '', '', '', '');
    $tb_product->setColsStyle($type_h);
    $tb_product->addHead($cont_h);
    $transaction_course = $man_transaction->getTransactionCourses($id_transaction);
    foreach ($transaction_course as $id_course => $details) {
        if (is_array($details)) {
            foreach ($details['dates'] as $id_date) {
                $date_info = $date_man->getDateInfo($id_date);
                $checked = false;
                $other = '';
                if ($man_transaction->controlActivation($id_transaction, $id_course, $id_date)) {
                    $checked = true;
                    $other = 'disabled="disabled"';
                }
                $tb_product->addBody(array($date_info['code'], $date_info['name'], Format::date($date_info['date_begin']), Format::date($date_info['date_end']), $date_info['price'], Form::getInputCheckbox($id_course . '_' . $id_date, 'confirm[' . $id_course . '_' . $id_date . ']', 1, $checked, $other)));
            }
        } else {
            $course_info = $course_man->getCourseInfo($id_course);
            $checked = false;
            $other = '';
            if ($man_transaction->controlActivation($id_transaction, $id_course)) {
                $checked = true;
                $other = 'disabled="disabled"';
            }
            $tb_product->addBody(array($course_info['code'], $course_info['name'], $course_info['date_begin'] !== '0000-00-00' ? Format::date($course_info['date_begin'], 'date') . ($course_info['hour_begin'] !== '-1' ? $course_info['hour_begin'] : '') : '', $course_info['date_end'] !== '0000-00-00' ? Format::date($course_info['date_end'], 'date') . ($course_info['hour_end'] !== '-1' ? $course_info['hour_end'] : '') : '', $course_info['prize'] == '' ? '0' : $course_info['prize'], Form::getInputCheckbox($id_course . '_0', 'confirm[' . $id_course . '_0]', 1, $checked, $other)));
        }
    }
    cout('<br />' . $tb_product->getTable() . Form::openButtonSpace() . Form::getButton('update', 'update', $lang->def('_UPDATE')) . Form::getButton('back_mod', 'back_mod', $lang->def('_BACK')) . Form::closeButtonSpace() . Form::closeForm());
    cout('</div>');
}
Ejemplo n.º 5
0
 /**
  * @param string 	$label_name 	text contained into the label
  * @param string 	$id 			the id of the element
  * @param string 	$name 			the name of the element
  * @param string 	$value 			value for the input field
  * @param boolean 	$is_checked
  *
  * @return string with the html code for the input type="checkbox" element
  */
 public static function getCheckboxSet($group_name, $id, $name, $all_value, $selected = false, $other_after = '', $other_before = '')
 {
     if ($selected == false) {
         $selected = array();
     }
     $count = 0;
     $out = '<div class="form_line_l">' . $other_before . '<p><span class="label_effect">' . $group_name . '</span></p>' . '<div class="grouping">';
     foreach ($all_value as $val_item => $label_item) {
         $out .= '<p>' . Form::getInputCheckbox($id . '_' . $val_item, $name . '[' . $val_item . ']', 1, isset($selected[$val_item]), '') . ' <label class="label_padded" for="' . $id . '_' . $val_item . '">' . $label_item . '</label>' . '</p>';
         $count++;
     }
     $out .= '</div>' . $other_after . '</div>';
     return $out;
 }
Ejemplo n.º 6
0
echo Form::getInputTextfield("search_t", "filter_text", "filter_text", $filter_text, '', 255, '');
echo Form::getButton("filter_set", "filter_set", Lang::t('_SEARCH', 'standard'), "search_b");
echo Form::getButton("filter_reset", "filter_reset", Lang::t('_RESET', 'standard'), "reset_b");
?>
		</div>
		<a id="advanced_search" class="advanced_search" href="javascript:;"><?php 
echo Lang::t("_ADVANCED_SEARCH", 'standard');
?>
</a>
		<div id="advanced_search_options" class="advanced_search_options" style="display: <?php 
echo $is_active_advanced_filter ? 'block' : 'none';
?>
">
			<?php 
//filter inputs
$orgchart_after = '<br />' . Form::getInputCheckbox('filter_descendants', 'filter_descendants', 1, $filter_descendants ? true : false, "") . '&nbsp;<label for="filter_descendants">' . Lang::t('_ORG_CHART_INHERIT', 'organization_chart') . '</label>';
echo Form::getDropdown(Lang::t('_DIRECTORY_MEMBERTYPETREE', 'admin_directory'), 'filter_orgchart', 'filter_orgchart', $orgchart_list, (int) $filter_orgchart, $orgchart_after);
echo Form::getDropdown(Lang::t('_GROUPS', 'standard'), 'filter_groups', 'filter_groups', $groups_list, (int) $filter_groups);
//buttons
echo Form::openButtonSpace();
echo Form::getButton('set_advanced_filter', false, Lang::t('_SEARCH', 'standard'));
echo Form::getButton('reset_advanced_filter', false, Lang::t('_UNDO', 'standard'));
echo Form::closeButtonSpace();
?>
		</div>
	</div>
</div>
<?php 
$columns = array(array('key' => 'userid', 'label' => Lang::t('_USERNAME', 'standard'), 'sortable' => true, 'formatter' => 'CourseStats.useridFormatter', 'className' => 'min-cell'), array('key' => 'fullname', 'label' => Lang::t('_NAME', 'standard'), 'sortable' => true, 'formatter' => 'CourseStats.fullnameFormatter', 'className' => 'min-cell'), array('key' => 'level', 'label' => Lang::t('_LEVEL', 'standard'), 'sortable' => true, 'className' => 'min-cell'), array('key' => 'status', 'label' => Lang::t('_STATUS', 'standard'), 'sortable' => true, 'className' => 'min-cell', 'editor' => 'CourseStats.statusEditor'));
foreach ($lo_list as $lo) {
    $icon = '(' . $lo->type . ')';
Ejemplo n.º 7
0
 public function printPageWithElement($id, $idst)
 {
     $adm_old_perm = $this->preference->getAdminPerm($idst);
     $array_image = array('add_category' => 'ico-sprite subs_view', 'mod_category' => 'ico-sprite subs_view', 'del_category' => 'ico-sprite subs_view', 'view' => 'ico-sprite subs_view', 'add' => 'ico-sprite subs_add', 'mod' => 'ico-sprite subs_mod', 'del' => 'ico-sprite subs_del', 'associate_user' => 'ico-sprite subs_users', 'approve_waiting_user' => 'ico-sprite subs_user', 'subscribe' => 'ico-sprite subs_users', 'moderate' => 'ico-sprite subs_user');
     switch ($id) {
         case 'framework':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %adm_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %adm_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'menu'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/framework/admin/' . strtolower($mvc_name) . '/';
                             require_once _adm_ . '/models/' . $mvc_name . 'Adm.php';
                             $class_name = $mvc_name . 'Adm';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _adm_ . '/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/framework/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     if (!empty($total_perm)) {
                         foreach ($total_perm as $perm => $img) {
                             $classname = isset($array_image[$perm]) ? $array_image[$perm] : "ico-sprite";
                             $th[] = '<span class="' . $classname . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                             $ts[] = 'image';
                         }
                         $tb->addHead($th);
                         $tb->setColsStyle($ts);
                         $result_under = sql_query($query);
                         while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                             if ($mvc_path !== '') {
                                 $tmp = explode('/', $mvc_path);
                                 $mvc_name = ucwords($tmp[1]);
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$mvc_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             } else {
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$class_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             }
                         }
                         //End while 2
                         echo $tb->getTable() . '<br/><br/>';
                     }
                 }
             }
             //End while
             break;
         case 'lms':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %lms_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %lms_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'menu'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/lms/admin/' . strtolower($mvc_name) . '/';
                             require_once _lms_ . '/admin/models/' . $mvc_name . 'Alms.php';
                             $class_name = $mvc_name . 'Alms';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _lms_ . '/admin/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/lms/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     if (!empty($total_perm)) {
                         foreach ($total_perm as $perm => $img) {
                             $th[] = '<span class="' . $array_image[$perm] . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                             $ts[] = 'image';
                         }
                         $tb->addHead($th);
                         $tb->setColsStyle($ts);
                         $result_under = sql_query($query);
                         while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                             if ($mvc_path !== '') {
                                 $tmp = explode('/', $mvc_path);
                                 $mvc_name = ucwords($tmp[1]);
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$mvc_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             } else {
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$class_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             }
                         }
                         //End while 2
                         echo $tb->getTable() . '<br/><br/>';
                     }
                 }
             }
             //End while
             break;
         case 'scs':
             echo 'scs';
             break;
         case 'cms':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %cms_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %cms_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'adminrules'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/cms/admin/' . strtolower($mvc_name) . '/';
                             require_once _cms_ . '/admin/models/' . $mvc_name . '.php';
                             $class_name = $mvc_name . '';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'adminrules'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _cms_ . '/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/cms/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'adminrules'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     foreach ($total_perm as $perm => $img) {
                         $th[] = '<span class="' . $array_image[$perm] . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                         $ts[] = 'image';
                     }
                     $tb->addHead($th);
                     $tb->setColsStyle($ts);
                     $result_under = sql_query($query);
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $content = array(Lang::t($default_name, 'adminrules'));
                             foreach ($total_perm as $perm => $img) {
                                 if (isset($module_perm[$mvc_name][$perm])) {
                                     $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                 } else {
                                     $content[] = '';
                                 }
                             }
                             reset($total_perm);
                             $tb->addBody($content);
                         } else {
                             $content = array(Lang::t($default_name, 'adminrules'));
                             foreach ($total_perm as $perm => $img) {
                                 if (isset($module_perm[$class_name][$perm])) {
                                     $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                 } else {
                                     $content[] = '';
                                 }
                             }
                             reset($total_perm);
                             $tb->addBody($content);
                         }
                     }
                     //End while 2
                     echo $tb->getTable() . '<br/><br/>';
                 }
             }
             //End while
             break;
         case 'ecom':
             echo 'ecom';
             break;
     }
 }
Ejemplo n.º 8
0
 function _get_games_query($type = 'html', $report_data = NULL, $other = '')
 {
     require_once dirname(__FILE__) . '/report_tableprinter.php';
     if ($report_data == NULL) {
         $ref =& $_SESSION['report_tempdata'];
     } else {
         $ref =& $report_data;
     }
     $_ERR_NOUSER = Lang::t('_EMPTY_SELECTION', 'report');
     $_ERR_NOCOMP = Lang::t('_EMPTY_SELECTION', 'report');
     $_ERR_NODATA = Lang::t('_NO_CONTENT', 'report');
     //LO object types translations
     require_once _lms_ . '/lib/lib.report.php';
     $lang_type = _getLOtranslations();
     $sel_all = $ref['rows_filter']['all_users'];
     $arr_selected_users = $ref['rows_filter']['users'];
     //list of users selected in the filter (users, groups and org.branches)
     $comp_all = isset($ref['columns_filter']['all_games']) ? $ref['columns_filter']['all_games'] : false;
     $arr_selected_comp = isset($ref['columns_filter']['comp_selection']) ? $ref['columns_filter']['comp_selection'] : array();
     //list of communications selected in the filter
     $start_date = isset($ref['columns_filter']['comp_start_date']) ? substr($ref['columns_filter']['comp_start_date'], 0, 10) : '';
     $end_date = isset($ref['columns_filter']['comp_end_date']) ? substr($ref['columns_filter']['comp_end_date'], 0, 10) : '';
     //check and validate time period dates
     if (!preg_match('/^(\\d{4})\\D?(0[1-9]|1[0-2])\\D?([12]\\d|0[1-9]|3[01])$/', $start_date) || $start_date == '0000-00-00') {
         $start_date = '';
     }
     if (!preg_match('/^(\\d{4})\\D?(0[1-9]|1[0-2])\\D?([12]\\d|0[1-9]|3[01])$/', $end_date) || $end_date == '0000-00-00') {
         $end_date = '';
     }
     if ($start_date != '') {
         $start_date .= ' 00:00:00';
     }
     if ($end_date != '') {
         $end_date .= ' 23:59:59';
     }
     if ($start_date != '' && $end_date != '') {
         if ($start_date > $end_date) {
             //invalid time period
             $start_date = '';
             $end_date = '';
         }
     }
     //other checkings and validations
     if (!$sel_all && count($selection) <= 0) {
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     $acl_man = new DoceboACLManager();
     $acl_man->include_suspended = true;
     //extract user idst from selection
     if ($sel_all) {
         $arr_selected_users = $acl_man->getAllUsersIdst();
     } else {
         $arr_selected_users = $acl_man->getAllUsersFromIdst($arr_selected_users);
     }
     if ($comp_all) {
         $query = "SELECT id_game FROM %lms_games";
         $res = $this->db->query($query);
         $arr_selected_comp = array();
         while (list($id_game) = $this->db->fetch_row($res)) {
             $arr_selected_comp[] = $id_game;
         }
     }
     //admin users filter
     $userlevelid = Docebo::user()->getUserLevelId();
     if ($userlevelid != ADMIN_GROUP_GODADMIN && !Docebo::user()->isAnonymous()) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
         $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
         $admin_users = array_unique($admin_users);
         //filter users selection by admin visible users
         $arr_selected_users = array_intersect($arr_selected_users, $admin_users);
         //free some memory
         unset($admin_tree);
         unset($admin_users);
         unset($adminManager);
     }
     //check selected users ...
     if (count($arr_selected_users) <= 0) {
         //message: no users selected
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     //check selected communications ...
     if (count($arr_selected_comp) <= 0) {
         //message: no communications selected
         cout('<p>' . $_ERR_NOCOMP . '</p>');
         return;
     }
     //set table properties and buffer
     $head = array(Lang::t('_GAMES_TITLE', 'report'), Lang::t('_GAMES_TYPE', 'report'), Lang::t('_FROM', 'report'), Lang::t('_TO', 'report'), Lang::t('_USER', 'report'), Lang::t('_GAMES_ATTEMPTED', 'report'), Lang::t('_GAMES_ATTEMPT_DATE', 'report'), Lang::t('_GAMES_FIRST_ATTEMPT_DATE', 'report'), Lang::t('_GAMES_CURRENT_SCORE', 'report'), Lang::t('_GAMES_MAX_SCORE', 'report'), Lang::t('_GAMES_NUM_ATTEMPTS', 'report'));
     if ($this->use_mail) {
         $head[] = array('style' => 'img-cell', 'value' => $this->_loadEmailIcon());
     }
     $buffer = new ReportTablePrinter();
     $buffer->openTable('', '');
     $buffer->openHeader();
     $buffer->addHeader($head);
     $buffer->closeHeader();
     $buffer->openBody();
     //rows cycle
     //which selected communication has been seen by selected users?
     $_YES = Lang::t('_YES', 'standard');
     $_NO = Lang::t('_NO', 'standard');
     $arr_viewed = array();
     $query = "SELECT ct.idReference, c.title, c.type_of, c.start_date, c.end_date, ct.status, " . " ct.dateAttempt, ct.firstAttempt, ct.idUser, u.userid, u.firstname, u.lastname, " . " ct.current_score, ct.max_score, ct.num_attempts " . " FROM (%lms_games_track as ct " . " JOIN %lms_games as c ON (ct.idReference=c.id_game)) " . " JOIN %adm_user as u ON (ct.idUser=u.idst) " . " WHERE ct.idUser IN (" . implode(",", $arr_selected_users) . ") " . " AND c.id_game IN (" . implode(",", $arr_selected_comp) . ") " . ($start_date != '' ? " AND ct.dateAttempt >= '" . $start_date . "' " : "") . ($end_date != '' ? " AND ct.dateAttempt <= '" . $end_date . "' " : "") . " ORDER BY c.title, u.userid";
     $res = $this->db->query($query);
     if ($this->db->num_rows($res) <= 0) {
         cout('<p>' . $_ERR_NODATA . '</p>');
         return;
     }
     while ($obj = $this->db->fetch_obj($res)) {
         $line = array();
         $line[] = $obj->title;
         $line[] = isset($lang_type[$obj->type_of]) ? $lang_type[$obj->type_of] : '';
         $line[] = Format::date($obj->start_date, "date");
         $line[] = Format::date($obj->end_date, "date");
         $line[] = $acl_man->relativeId($obj->userid);
         $line[] = $obj->status == 'completed' || $obj->status == 'passed' ? $_YES : $_NO;
         $line[] = Format::date($obj->dateAttempt, "datetime");
         $line[] = Format::date($obj->firstAttempt, "datetime");
         $line[] = $obj->current_score;
         $line[] = $obj->max_score;
         $line[] = $obj->num_attempts;
         if ($this->use_mail) {
             $line[] = '<div class="align_center">' . Form::getInputCheckbox('mail_' . $obj->idUser, 'mail_recipients[]', $obj->idUser, isset($_POST['select_all']), '') . '</div>';
         }
         $buffer->addLine($line);
     }
     $buffer->closeBody();
     $buffer->closeTable();
     cout($buffer->get());
     $this->_loadEmailActions();
 }
Ejemplo n.º 9
0
 /**
  * This method create an HTML UI for create the map of fields from
  * source to destination
  **/
 function getUIMap()
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('organization_chart', 'framework');
     $form = new Form();
     $table = new Table(Get::sett('visuItem'), $lang->def('_IMPORT_MAP'), $lang->def('_IMPORT_MAP'));
     $src_cols = $this->source->get_cols_descripor();
     $dst_cols = $this->destination->get_cols_descripor();
     $combo_elements = array();
     foreach ($dst_cols as $col) {
         if (isset($col[DOCEBOIMPORT_COLID])) {
             $combo_elements[$col[DOCEBOIMPORT_COLID]] = $col[DOCEBOIMPORT_COLNAME];
         } else {
             $combo_elements[$col[DOCEBOIMPORT_COLNAME]] = $col[DOCEBOIMPORT_COLNAME];
         }
     }
     $combo_elements[DOCEBOIMPORT_IGNORE] = $lang->def('_IMPORT_IGNORE');
     $table_dst_labels = array();
     $table_src_labels = array();
     $table_src_labels_type = array();
     $count = 0;
     foreach ($src_cols as $col) {
         $pk = '0';
         $map = '';
         if (isset($this->import_map[$count])) {
             $pk = isset($this->import_map[$count]['pk']) ? $this->import_map[$count]['pk'] : "0";
             $map = isset($this->import_map[$count]['map']) ? $this->import_map[$count]['map'] : "";
         }
         $table_src_labels[] = $col[DOCEBOIMPORT_COLNAME] . $form->getInputCheckbox("import_map_" . $count . "_pk", "import_map[" . $count . "][pk]", "1", $pk == '1', '');
         $table_src_labels_type[] = '';
         $table_dst_labels[] = $form->getInputDropdown("dropdown_nowh", "import_map_" . $count . "_map", "import_map[" . $count . "][map]", $combo_elements, $map, "");
         $count++;
     }
     $table->setColsStyle($table_src_labels_type);
     $table->addHead($table_dst_labels);
     $table->addHead($table_src_labels);
     $count = 0;
     $row = $this->source->get_first_row();
     while ($row !== FALSE && $count < 10) {
         $table->addBody($row);
         $row = $this->source->get_next_row();
         $count++;
     }
     return $table->getTable();
 }
Ejemplo n.º 10
0
<?php

echo getTitleArea(array(Lang::t('_COMMUNICATIONS', 'communication')));
?>
<div class="std_block">
<?php 
//--- SEARCH FILTER -------
$this->widget('tablefilter', array('id' => 'communication', 'filter_text' => $filter_text, 'js_callback_set' => 'Communications.setFilter', 'js_callback_reset' => 'Communications.resetFilter', 'auxiliary_filter' => Form::getInputCheckbox('show_descendants', 'show_descendants', '1', $show_descendants ? true : false, '') . ' <label class="label_normal" for="show_descendants">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>'));
?>
<div class="panel_left_small">
<span class="title"><?php 
echo Lang::t('_ALL_CATEGORIES', 'communication');
?>
</span>
<?php 
//--- TREEVIEW -------
//Categories tree
$languages = array('_ROOT' => Lang::t('_COMMUNICATIONS', 'communication'), '_NEW_FOLDER_NAME' => Lang::t('_NEW_CATEGORY', 'course'), '_MOD' => Lang::t('_MOD', 'course'), '_AREYOUSURE' => Lang::t('_AREYOUSURE', 'standard'), '_NAME' => Lang::t('_NAME', 'standardt'), '_MOD' => Lang::t('_MOD', 'standard'), '_DEL' => Lang::t('_DEL', 'standard'), '_SAVE' => Lang::t('_SAVE', 'standard'), '_CONFIRM' => Lang::t('_CONFIRM', 'standard'), '_UNDO' => Lang::t('_UNDO', 'standard'), '_ADD' => Lang::t('_ADD', 'standard'), '_YES' => Lang::t('_YES', 'standard'), '_NO' => Lang::t('_NO', 'standard'), '_INHERIT' => Lang::t('_ORG_CHART_INHERIT', 'organization_chart'), '_NEW_FOLDER' => Lang::t('_NEW_FOLDER', 'organization_chart'), '_RENAMEFOLDER' => Lang::t('_MOD', 'standard'), '_DELETEFOLDER' => Lang::t('_DEL', 'standard'), '_AJAX_FAILURE' => Lang::t('_CONNECTION_ERROR', 'standard'));
$_tree_params = array('id' => 'category_tree', 'ajaxUrl' => 'ajax.adm_server.php?r=alms/communication/gettreedata', 'treeClass' => 'CommunicationsFolderTree', 'treeFile' => Get::rel_path('lms') . '/admin/views/communication/communicationfoldertree.js', 'languages' => $languages, 'initialSelectedNode' => $selected_category, 'dragDrop' => true, 'show' => 'tree');
if ($permissions['add_category']) {
    $rel_title = Lang::t('_NEW_CATEGORY', 'course');
    $rel_url = 'ajax.adm_server.php?r=alms/communication/add_category&id=' . $selected_category;
    $rel_action = '<a class="ico-wt-sprite subs_add" id="add_category" href="' . $rel_url . '" ' . ' title="' . $rel_title . '"><span>' . $rel_title . '</span></a>';
    $_tree_params['rel_action'] = $rel_action;
    //Add category dialog
    $this->widget('dialog', array('id' => 'add_category_dialog', 'dynamicContent' => true, 'ajaxUrl' => 'this.href', 'dynamicAjaxUrl' => true, 'callback' => 'Communications.addCategoryCallback', 'renderEvent' => 'Communications.dialogRenderEvent', 'callEvents' => array(array('caller' => 'add_category', 'event' => 'click'))));
}
$this->widget('tree', $_tree_params);
?>
</div>
Ejemplo n.º 11
0
function subscribedel()
{
    checkPerm('subscribe', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $id_course = importVar('id_course', true, 0);
    $course_to_save = Man_Course::saveCourseStatus();
    $edition_id = getCourseEditionId();
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $levels = CourseLevel::getLevels();
    $user_alredy_subscribed = getSubscribed($id_course, false, false, true, $edition_id);
    $user_levels = getSubscribedLevel($id_course, false, false, $edition_id);
    require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
    $adminManager = new AdminManager();
    $acl_manager = new DoceboACLManager();
    $idst_associated = $adminManager->getAdminTree(getLogUserId());
    $array_user_associated =& $acl_manager->getAllUsersFromIdst($idst_associated);
    $user_level = Docebo::user()->getUserLevelId();
    if ($user_level != ADMIN_GROUP_GODADMIN) {
        $user_alredy_subscribed = array_intersect($user_alredy_subscribed, $array_user_associated);
    }
    $user_selected_info =& $acl_man->getUsers($user_alredy_subscribed);
    $GLOBALS['page']->add(getTitleArea($lang->def('_SUBSCRIBE'), 'subscribe') . '<div class="std_block">' . Form::openForm('levelselection', 'index.php?modname=subscribe&amp;op=subscriberemove') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
    $tb = new Table(0, $lang->def('_CAPTION_SELECT_LEVELS'), $lang->def('_SUMMARY_SELECT_LEVEL'));
    $type_h = array('', '', '', 'image');
    $content_h = array($lang->def('_USERNAME'), $lang->def('_FULLNAME'), $lang->def('_LEVEL'), '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '">');
    $tb->addHead($content_h, $type_h);
    $num_user_sel = 0;
    if (is_array($user_selected_info)) {
        reset($user_selected_info);
        while (list($id_user, $user_info) = each($user_selected_info)) {
            // if the user isn't alredy subscribed to the course
            $content = array(substr($user_info[ACL_INFO_USERID], 1), $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME], $levels[$user_levels[$id_user]], $content[] = Form::getInputCheckbox('user_to_remove' . $id_user, 'user_to_remove[' . $id_user . ']', $id_user, false, '') . '<label class="access-only" for="user_to_remove' . $id_user . '">' . $user_info[ACL_INFO_USERID] . '</label>');
            $tb->addBody($content);
        }
        $GLOBALS['page']->add($tb->getTable(), 'content');
    }
    $GLOBALS['page']->add(Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_DEL')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Ejemplo n.º 12
0
 function group()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.navbar.php';
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('standard', 'lms');
     $field_search = importVar('field_search');
     $search = isset($_POST['search']) && $_POST['search'] != '' ? $_POST['search'] : false;
     if (isset($_POST['clear'])) {
         $search = false;
     }
     $acl_man =& Docebo::user()->getAclManager();
     $acl =& Docebo::user()->getAcl();
     $groups =& $acl_man->getAllGroupsId(array('free', 'moderate', 'private'), $search);
     $user_group_wait =& $acl_man->getPendingGroupOfUser(getLogUserId());
     $hidden_group = array();
     if (!isset($_POST['working'])) {
         $user_group = $acl->getSTGroupsST(getLogUserId());
         $user_group = array_flip($user_group);
     } else {
         if (isset($_POST['group_sel'])) {
             $user_group = $_POST['group_sel'];
             $hidden_group = array_diff($user_group, $groups);
         } else {
             $user_group = array();
         }
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_MYGROUP'), 'mygroup') . '<div class="std_block">' . Form::openForm('group_subscription', 'index.php?modname=mygroup&amp;op=group') . Form::getHidden('working', 'working', 1) . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getTextfield($lang->def('_SEARCH_ARG'), 'search', 'search', '255', isset($_POST['search']) && !isset($_POST['clear']) ? $_POST['search'] : '') . Form::openButtonSpace() . Form::getButton('search_button', 'search_button', $lang->def('_SEARCH')) . ($search ? Form::getButton('clear', 'clear', $lang->def('_CLEAR')) : '') . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
     if (is_array($hidden_group)) {
         while (list(, $id) = each($hidden_group)) {
             $GLOBALS['page']->add(Form::getHidden('group_sel_' . $id, 'group_sel[' . $id . ']', $id), 'content');
         }
     }
     if (!empty($groups)) {
         $tb = new Table(0, $lang->def('_MYGROUP_CAPTION'), $lang->def('_MYGROUP_SUMMARY'));
         $type_h = array('image', 'nowrap', '');
         $cont_h = array('<span class="access-only">' . $lang->def('_SUBSCRIBE') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         while (list($id, $info) = each($groups)) {
             echo $id;
             $cont = array();
             if (isset($user_group[$id])) {
                 $cont[] = Form::getInputCheckbox('group_sel_' . $id, 'group_sel[' . $id . ']', $id, isset($user_group[$id]), '');
                 $cont[] = $info['type_ico'] . ' ' . $info['groupid'] . '</label>';
                 $cont[] = $info['description'];
             } elseif (isset($user_group_wait[$id])) {
                 $cont[] = '<img src="' . getPathImage() . 'standard/userwait.gif" alt="' . $lang->def('_WAITING') . '" />';
                 $cont[] = '<label for="group_sel_' . $id . '">' . $info['type_ico'] . ' ' . $info['groupid'] . '</label>';
                 $cont[] = $info['description'];
             } elseif ($info['type'] != 'private' && $info['type'] != 'invisible') {
                 $cont[] = Form::getInputCheckbox('group_sel_' . $id, 'group_sel[' . $id . ']', $id, isset($user_group[$id]), '');
                 $cont[] = '<label for="group_sel_' . $id . '">' . $info['type_ico'] . ' ' . $info['groupid'] . '</label>';
                 $cont[] = $info['description'];
             }
             $tb->addBody($cont);
         }
         $GLOBALS['page']->add(Form::openForm('group_subscription_sec', 'index.php?modname=mygroup&amp;op=savesel') . Form::getHidden('search_hidden', 'search', '255', $search) . $tb->getTable() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
     }
     $GLOBALS['page']->add('</div>', 'content');
 }
Ejemplo n.º 13
0
 function loadCourseSelector($noprint = false, $with_assesment = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('course', 'lms');
     $output = '';
     $output .= $this->treeview->load();
     // Filter
     $this->filter['course_flat'] = isset($_POST['c_flatview']);
     //$this->filter['course_code'] = ( isset($_POST['c_filter_code']) ? $_POST['c_filter_code'] : '' );
     $this->filter['course_name'] = isset($_POST['c_filter_name']) ? $_POST['c_filter_name'] : '';
     if ($this->show_filter === true) {
         $output .= '<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('c_flatview', 'c_flatview', '1', Get::req('c_flatview', DOTY_INT, '0') == '1' ? true : false, ' onclick="submit();" ') . ' <label class="label_normal" for="c_flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . '</div>' . '<div>' . Form::getInputTextfield("search_t", "c_filter_name", "c_filter_name", Get::req('c_filter_name', DOTY_ALPHANUM, ''), '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visu_course'), $lang->def('_COURSE_LIST'), $lang->def('_COURSE_LIST_SUMMARY'));
     $tb->initNavBar('ini', 'button');
     $ini = $tb->getSelectedElement();
     $category_selected = $this->treeview->getSelectedFolderId();
     if ($this->filter['course_flat']) {
         $id_categories = $this->treeDB->getDescendantsId($this->treeDB->getFolderById($category_selected));
         $id_categories[] = $category_selected;
     }
     $select = "\r\n\t\tSELECT c.idCourse, c.code, c.name, c.description, c.status, c.difficult,\r\n\t\t\tc.subscribe_method, c.permCloseLo, c.show_rules, c.max_num_subscribe ";
     $query_course = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE " . ($with_assesment ? '1' : "c.course_type <> 'assessment'") . " AND c.idCategory IN ( " . (!$this->filter['course_flat'] ? $category_selected : implode(",", $id_categories)) . " )";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         $all_courses = false;
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array(0);
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $courses = array_merge($courses, $catalogue_course);
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $admin_courses['course'][$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             $array_courses = array();
             $array_courses = array_merge($array_courses, $admin_courses['course']);
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new CoursePath_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
             $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses);
         }
         if (!$all_courses) {
             if (empty($admin_courses['course'])) {
                 $query_course .= " AND 0 ";
             } else {
                 $query_course .= " AND c.idCourse IN (" . implode(',', $admin_courses['course']) . ") ";
             }
         }
     }
     /*
     		if($this->filter['course_code'] != '') {
     			$query_course .= " AND c.code LIKE '%".$this->filter['course_code']."%'";
     		}*/
     if ($this->filter['course_name'] != '') {
         $query_course .= " AND ( c.code LIKE '%" . $this->filter['course_name'] . "%' OR c.name LIKE '%" . $this->filter['course_name'] . "%' ) ";
     }
     list($tot_course) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_course));
     $query_course .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem', 25);
     $re_course = sql_query($select . $query_course);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_COURSE_SELECTION') . '</span>', $lang->def('_CODE'), $lang->def('_COURSE_NAME'), $lang->def('_STATUS'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $status_array = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course'));
     while (list($id_course, $code, $name, $desc, $status, $difficult, $auto_sub, $end_mode, $show_rules, $max_user_sub) = sql_fetch_row($re_course)) {
         $tb_content = array(Form::getInputCheckbox('new_course_selected_' . $id_course, 'new_course_selected[' . $id_course . ']', $id_course, isset($this->current_selection[$id_course]), ''), '<label for="new_course_selected_' . $id_course . '">' . $code . '</label>', '<label for="new_course_selected_' . $id_course . '">' . $name . '</label>');
         $tb_content[] = $status_array[$status];
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_course])) {
             unset($this->current_selection[$id_course]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_course) . $this->stateSelection();
     //, 'content');
     if ($noprint) {
         return $output;
     } else {
         cout($output);
     }
 }
Ejemplo n.º 14
0
 function loadSimpleSelector($anonymous = true, $orgchart_button = false)
 {
     $res = "";
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . "/lib/lib.form.php";
     $lang =& DoceboLanguage::createInstance('simplesel', 'framework');
     $form = new Form();
     $acl_manger = Docebo::user()->getAclManager();
     $anonymous_idst = $acl_manger->getAnonymousId();
     $res .= getBackUi($this->getLink("back"), $lang->def("_BACK"));
     if ($this->hasManualSelection()) {
         $msg = $lang->def('_MSG_HASMANUAL_1') . " \"" . $lang->def('_MANUAL_SEL') . "\" " . $lang->def('_MSG_HASMANUAL_2');
         $res .= getInfoUi($msg);
     }
     $url = $this->getLink("main");
     $res .= $form->openForm("simple_selector", $url);
     $vis_item = $GLOBALS["framework"]["visuItem"];
     $tab = new Table(2, $lang->def("_SIMPLESEL_TITLE"), $lang->def("_SIMPLESEL_TITLE"));
     $head_type = array('');
     $head = array($lang->def("_USERS"));
     foreach ($this->getPermList() as $key => $val) {
         $head_type[] = "image";
         $img = "<img src=\"" . $val["img"] . "\" alt=\"" . $val["alt"] . "\" ";
         $img .= "title=\"" . $val["alt"] . "\" />";
         $head[] = $img;
     }
     $tab->setColsStyle($head_type);
     $tab->addHead($head);
     $users_list = $this->getSimpleUserList();
     $saved_data = $this->getSavedData();
     if (!$anonymous) {
         unset($users_list[$anonymous_idst]);
     }
     foreach ($users_list as $idst => $label) {
         $rowcnt = array($label);
         foreach ($this->getPermList() as $key => $val) {
             $chk = false;
             if (isset($saved_data[$key]) && is_array($saved_data[$key])) {
                 if (in_array($idst, array_keys($saved_data[$key]))) {
                     $chk = true;
                 }
             }
             $check_box = $form->getLabel($key . "_" . $idst . "_", $lang->def("_VIEW") . " " . $label, "access-only");
             $check_box .= $form->getInputCheckbox($key . "_" . $idst . "_", $key . "[" . $idst . "]", 1, $chk, NULL);
             $rowcnt[] = $check_box;
         }
         $tab->addBody($rowcnt);
     }
     $res .= $tab->getTable();
     $res .= $form->getHidden("saved_data", "saved_data", urlencode(serialize($saved_data)));
     $res .= $form->openButtonSpace();
     if ($orgchart_button) {
         $res .= $form->getButton('orgchartselector', 'orgchartselector', $lang->def('_ORGCHART_SEL'), "transparent_aslink_button") . ' ';
     }
     $res .= $form->getButton('manualselector', 'manualselector', $lang->def('_MANUAL_SEL'), "transparent_aslink_button");
     $res .= $form->closeButtonSpace();
     $res .= $form->openButtonSpace();
     $res .= $form->getButton('okselector', 'okselector', $lang->def('_CONFIRM'));
     $res .= $form->getButton('cancelselector', 'cancelselector', $lang->def('_UNDO'));
     $res .= $form->closeButtonSpace();
     $res .= $form->closeForm();
     return $res;
 }
Ejemplo n.º 15
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('configuration', 'lms');
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size \r\n\t\tFROM " . $this->table . " \r\n\t\tWHERE regroup = '" . $regroup . "' AND \r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             case "point_field":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields();
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value);
                 break;
             case "language":
                 //drop down language
                 $langs = Docebo::langManager()->getAllLangCode();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $langs, array_search($var_value, $langs));
                 break;
             case "template":
                 //drop down template
                 $templ = getTemplateList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ));
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $ht_edit, $var_value);
                 break;
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value);
                 break;
             case "sel_news":
                 $mode = array('off' => Lang::t('_DONT_SHOW'), 'link' => Lang::t('_SHOW_AS_LINK'), 'block' => Lang::t('_SHOW_AS_BLOCK'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $mode, $var_value);
                 break;
             case "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . ' ' . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name))) . Form::closeFormLine();
                 break;
             case "menuvoice":
             case "menuvoice_course_public":
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 break;
             case "tablist_coursecatalogue":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_selected = unserialize(urldecode($var_value));
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 foreach ($tab_list as $tab_code => $name) {
                     $html .= Form::getCheckbox($name, 'tablist_' . $tab_code, 'tablist[' . $tab_code . ']', 1, isset($tab_selected[$tab_code]));
                 }
                 break;
             case "first_coursecatalogue_tab":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $tab_list, $var_value);
                 break;
             case "tablist_mycourses":
                 //$var_value=deformat($var_value);
                 $arr_value = explode(',', $var_value);
                 //$arr_value=array();
                 $tab_list = array();
                 $tab_list[''] = $lang->def('_MYCOURSES_NOTUSED');
                 $tab_list['status'] = $lang->def('_STATUS');
                 $tab_list['name'] = $lang->def('_NAME');
                 $tab_list['code'] = $lang->def('_CODE');
                 $html .= '<div class="form_line_l"><p>' . '<label class="floating">' . $lang->def('_' . strtoupper($var_name)) . '</label></p>';
                 for ($i = 0; $i < 3; $i++) {
                     $html .= Form::getInputDropdown('dropdown', $var_name . '_' . $i, "mycourses[{$i}]", $tab_list, isset($arr_value[$i]) ? $arr_value[$i] : '', '');
                 }
                 $html .= '</div>';
                 break;
                 //string or int
             //string or int
             default:
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
         }
     }
     return $html;
 }
Ejemplo n.º 16
0
echo Form::getDropdown(Lang::t('_LEVEL', 'subscribe'), 'select_level_mode', 'select_level_mode', array('manual' => Lang::t('_MANUAL', 'subscribe'), 'students' => Lang::t('_LEVEL_3', 'levels')), 'manual');
echo Form::getDatefield(Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe'), 'set_date_begin_validity', 'set_date_begin_validity', '', false, false, '', '', Form::getInputCheckbox('sel_date_begin_validity', 'sel_date_begin_validity', 1, false, ''));
echo Form::getDatefield(Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe'), 'set_date_expire_validity', 'set_date_expire_validity', '', false, false, '', '', Form::getInputCheckbox('sel_date_expire_validity', 'sel_date_expire_validity', 1, false, ''));
?>
</div>
<script type="text/javascript">
var E = YAHOO.util.Event;
E.onDOMReady(function() {

	E.addListener("set_date_begin_validity", "change", function() {});
	E.addListener("set_date_expire_validity", "change", function() {});

	E.addListener("advanced_options", "click", function(e) {
		var el = YAHOO.util.Dom.get("advanced_subs_options");
		if (el.style.display != 'block') {
			el.style.display = 'block'
		} else {
			el.style.display = 'none'
		}
	});

});
</script>
<br/>
<br/>
<?php 
$this->widget('userselector', array('id' => 'main_selector', 'show_user_selector' => true, 'show_group_selector' => true, 'show_orgchart_selector' => true, 'show_fncrole_selector' => true, 'initial_selection' => $user_alredy_subscribed, 'admin_filter' => true));
echo Form::openButtonSpace() . Form::getInputCheckbox('send_alert', 'send_alert', 1, $send_alert, false) . ' <label for="send_alert">' . Lang::t('_SEND_ALERT', 'subscribe') . '</label>&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getButton('okselector', 'okselector', Lang::t('_NEXT', 'standard')) . Form::getButton('cancelselector', 'cancelselector', Lang::t('_UNDO', 'standard')) . Form::closeButtonSpace();
echo Form::closeForm();
?>
</div>
Ejemplo n.º 17
0
function presence()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    YuiLib::load();
    Util::get_js(Get::rel_path('lms') . '/admin/views/classroom/classroom.js', true, true);
    $id_date = Get::req('id_date', DOTY_INT, 0);
    $lang =& DoceboLanguage::CreateInstance('admin_date', 'lms');
    $date_man = new DateManager();
    $user_date = $date_man->getUserDateForCourse(getLogUserId(), $_SESSION['idCourse']);
    $date_info = $date_man->getDateInfoForPublicPresence($user_date);
    foreach ($date_info as $info_date) {
        $date_for_dropdown[$info_date['id_date']] = $info_date['code'] . ' - ' . $info_date['name'] . ' (' . Format::date($info_date['date_begin'], 'date') . ')';
    }
    if ($id_date == 0) {
        $id_date = isset($date_info[0]['id_date']) ? $date_info[0]['id_date'] : 0;
    }
    cout(getTitleArea(Lang::t('_ATTENDANCE')) . '<div class="std_block">', 'content');
    if (isset($_POST['save'])) {
        require_once $GLOBALS['where_lms'] . '/lib/lib.date.php';
        $date_man = new DateManager();
        $id_date = Get::req('id_date', DOTY_INT, 0);
        $score_min = Get::req('score_min', DOTY_INT, 0);
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        foreach ($user as $id_user => $user_info) {
            $user[$id_user]['score'] = Get::req('score_' . $id_user, DOTY_INT, 0);
            $user[$id_user]['note'] = Get::req('note_' . $id_user, DOTY_MIXED, '');
            $user[$id_user]['day_presence'] = array();
            for ($i = 0; $i < count($day); $i++) {
                $user[$id_user]['day_presence'][$day[$i]['id_day']] = Get::req('date_' . $day[$i]['id_day'] . '_' . $id_user, DOTY_INT, 0);
            }
        }
        if ($date_man->insDatePresence($_SESSION['id_course_date'], $id_date, $user, $day, $score_min)) {
            UIFeedback::info(Lang::t('_ATTENDANCE_SAVED', 'admin_date'));
        } else {
            UIFeedback::error(Lang::t('_ATTENDANCE_SAVED_ERROR', 'admin_date'));
        }
    }
    if ($id_date == 0) {
        cout(Lang::t('_NO_CONTENT', 'admin_date'), 'content');
    } else {
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        $user_presence = $date_man->getUserPresenceForDate($id_date);
        $tb = new Table(0, Lang::t('_ATTENDANCE', 'admin_date'), Lang::t('_ATTENDANCE', 'admin_date'));
        $cont_h = array(Lang::t('_USERNAME', 'admin_date'), Lang::t('_FULLNAME', 'admin_date'));
        $type_h = array('', '');
        foreach ($day as $id_day => $day_info) {
            $cont_h[] = Format::date($day_info['date_begin'], 'date') . '<br />' . '<a href="javascript:;" onClick="checkAllDay(' . $id_day . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_DAY', 'presence') . '</a>') . ' ' . '<a href="javascript:;" onClick="unCheckAllDay(' . $id_day . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_DAY', 'presence') . '</a>');
            $type_h[] = 'align_center';
        }
        $cont_h[] = '';
        $type_h[] = 'img-cell';
        if ($test_type == _DATE_TEST_TYPE_PAPER) {
            $cont_h[] = Lang::t('_SCORE', 'admin_date');
            $type_h[] = 'align_center';
        }
        $cont_h[] = Lang::t('_NOTES', 'admin_date');
        $type_h[] = 'align_center';
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        cout(Form::openForm('presence_form', 'index.php?modname=presence&amp;op=presence') . Form::openElementSpace() . Form::getDropdown(Lang::t('_SELECT_EDITION', 'admin_date'), 'id_date', 'id_date', $date_for_dropdown, $id_date) . Form::closeElementSpace() . Form::openElementSpace() . ($test_type == 1 ? Form::getTextfield(Lang::t('_MIN_SCORE', 'admin_date'), 'score_min', 'score_min', 255, '') : ''), 'content');
        $array_user_id = array();
        foreach ($user as $id_user => $user_info) {
            reset($day);
            $array_user_id[] = $id_user;
            $cont = array();
            $cont[] = $user_info['userid'];
            $cont[] = $user_info['lastname'] . ' ' . $user_info['firstname'];
            foreach ($day as $id_day => $day_info) {
                if (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 1) {
                    $presence = true;
                } elseif (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 0) {
                    $presence = false;
                } else {
                    $presence = false;
                }
                $cont[] = Form::getInputCheckbox('date_' . $id_day . '_' . $id_user, 'date_' . $id_day . '_' . $id_user, 1, $presence, false);
            }
            $cont[] = '<a href="javascript:;" onClick="checkAllUser(' . $id_user . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_USER', 'presence') . '</a>') . '<br />' . '<a href="javascript:;" onClick="unCheckAllUser(' . $id_user . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_USER', 'presence') . '</a>');
            if ($test_type == _DATE_TEST_TYPE_PAPER) {
                if (isset($user_presence[$id_user]['0000-00-00']) && $user_presence[$id_user]['0000-00-00']['presence'] == 1) {
                    $passed = true;
                } else {
                    $passed = false;
                }
                $cont[] = Form::getTextfield('', 'score_' . $id_user, 'score_' . $id_user, 255, isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0');
            }
            $cont[] = Form::getSimpleTextarea('', 'note_' . $id_user, 'note_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : '', false, false, false, 2);
            $tb->addBody($cont);
        }
        cout($tb->getTable() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'admin_date')) . Form::closeElementSpace() . Form::closeForm() . '</div>', 'content');
        cout('<script type="text/javascript">' . 'var _MIN_SCORE_NOT_SET = "' . Lang::t('_MIN_SCORE_NOT_SET', 'admin_date') . '";' . 'YAHOO.util.Event.addListener("save", "click", controlMinScore);' . 'YAHOO.util.Event.addListener("id_date", "change", formSubmit);' . 'function checkAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = true;
}

function unCheckAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}

function checkAllUser(id_user)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_user + \']\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = true;
}

function unCheckAllUser(id_user)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_user + \']\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}' . '</script>', 'content');
    }
    cout('</div>', 'content');
}
Ejemplo n.º 18
0
 function org_waitingUser()
 {
     checkPerm('approve_waiting_user', false, 'directory', 'framework');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.usermanager.php';
     if (isset($_POST['ok_waiting'])) {
         $user_man = new UserManager();
         // Remove refused users
         $refused = array();
         $aopproved = array();
         if (isset($_POST['waiting_user_refuse'])) {
             while (list($idst) = each($_POST['waiting_user_refuse'])) {
                 $this->aclManager->deleteTempUser($idst, false, false, true);
             }
             $refused[] = $idst;
         }
         // Subscribed accepted users
         if (isset($_POST['waiting_user_accept'])) {
             $idst_usergroup = $this->aclManager->getGroup(false, ADMIN_GROUP_USER);
             $idst_usergroup = $idst_usergroup[ACL_INFO_IDST];
             $idst_oc = $this->aclManager->getGroup(false, '/oc_0');
             $idst_oc = $idst_oc[ACL_INFO_IDST];
             $idst_ocd = $this->aclManager->getGroup(false, '/ocd_0');
             $idst_ocd = $idst_ocd[ACL_INFO_IDST];
             $request = $this->aclManager->getTempUsers(false, true);
             while (list($idst) = each($_POST['waiting_user_accept'])) {
                 if ($this->aclManager->registerUser(addslashes($request[$idst]['userid']), addslashes($request[$idst]['firstname']), addslashes($request[$idst]['lastname']), $request[$idst]['pass'], addslashes($request[$idst]['email']), '', '', true, $idst)) {
                     $approved[] = $idst;
                     $this->aclManager->addToGroup($idst_usergroup, $idst);
                     $this->aclManager->addToGroup($idst_oc, $idst);
                     $this->aclManager->addToGroup($idst_ocd, $idst);
                     if ($request[$idst]['create_by_admin'] != 0) {
                         $pref = new UserPreferences($request[$idst]['create_by_admin']);
                         if ($pref->getAdminPreference('admin_rules.limit_user_insert') == 'on') {
                             $max_insert = $pref->getAdminPreference('admin_rules.max_user_insert');
                             $pref->setPreference('admin_rules.max_user_insert', $max_insert - 1);
                         }
                     }
                     $this->aclManager->deleteTempUser($idst, false, false, false);
                 }
             }
         }
         require_once _base_ . '/lib/lib.platform.php';
         require_once _base_ . '/lib/lib.eventmanager.php';
         // send the alert
         /*
         			if(!empty($refused)) {
         
         				$array_subst = array('[url]' => Get::sett('url'));
         
         				$msg_composer = new EventMessageComposer('admin_directory', 'framework');
         
         				$msg_composer->setSubjectLangText('email', '_REFUSED_USER_SBJ', false);
         				$msg_composer->setBodyLangText('email', '_REFUSED_USER_TEXT', $array_subst);
         
         				$msg_composer->setBodyLangText('sms', '_REFUSED_USER_TEXT_SMS', $array_subst);
         
         				createNewAlert(	'UserApproved', 'directory', 'edit', '1', 'Users refused',
         							$refused, $msg_composer );
         			}*/
         if (!empty($approved)) {
             $pl_man =& PlatformManager::createInstance();
             $array_subst = array('[url]' => Get::sett('url', ''));
             $msg_composer2 = new EventMessageComposer('admin_directory', 'framework');
             $msg_composer2->setSubjectLangText('email', '_APPROVED_USER_SBJ', false);
             $msg_composer2->setBodyLangText('email', '_APPROVED_USER_TEXT', $array_subst);
             $msg_composer2->setBodyLangText('sms', '_APPROVED_USER_TEXT_SMS', $array_subst);
             createNewAlert('UserApproved', 'directory', 'edit', '1', 'Users approved', $approved, $msg_composer2, true);
         }
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } elseif (isset($_POST['cancel_waiting'])) {
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } else {
         $tb = new Table(0, $this->lang->def('_WAITING_USERS'), $this->lang->def('_WAITING_USER_SUMMARY'));
         $type_h = array('', '', '', 'image', 'image');
         $cont_h = array($this->lang->def('_USERNAME'), $this->lang->def('_DIRECTORY_FULLNAME'), $this->lang->def('_BY'), '<img src="' . getPathImage('framework') . 'directory/wuser_accept.gif" alt="' . $this->lang->def('_ACCEPT') . '" ' . 'title="' . $this->lang->def('_ACCEPT_USER') . '" />', '<img src="' . getPathImage('framework') . 'directory/wuser_refuse.gif" alt="' . $this->lang->def('_REFUSE_USER') . '" ' . 'title="' . $this->lang->def('_REFUSE_USER_TITLE') . '" />');
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         $temp_users = $this->aclManager->getTempUsers(false, true);
         if ($temp_users !== false) {
             $idst_admins = array();
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $idst_admins[] = $info['create_by_admin'];
                 }
             }
             $admins = $this->aclManager->getUsers($idst_admins);
             reset($temp_users);
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $creator = $admins[$info['create_by_admin']][ACL_INFO_LASTNAME] . ' ' . $admins[$info['create_by_admin']][ACL_INFO_FIRSTNAME];
                     if ($creator == '') {
                         $creator = $this->aclManager->relativeId($admins[$info['create_by_admin']][ACL_INFO_USERID]);
                     }
                 } else {
                     $creator = $this->lang->def('_DIRECOTRY_SELFREGISTERED');
                 }
                 $more = isset($_GET['id_user']) && $_GET['id_user'] == $idst ? '<a href="index.php?modname=directory&amp;op=org_waitinguser"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=directory&amp;op=org_waitinguser&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
                 $cont = array($more . $this->aclManager->relativeId($info['userid']), $info['lastname'] . ' ' . $info['firstname'], $creator, Form::getInputCheckbox('waiting_user_accept_' . $idst, 'waiting_user_accept[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_accept_' . $idst, $this->lang->def('_ACCEPT'), 'access-only'), Form::getInputCheckbox('waiting_user_refuse_' . $idst, 'waiting_user_refuse[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_refuse_' . $idst, $this->lang->def('_REFUSE_USER'), 'access-only'));
                 $tb->addBody($cont);
                 if (isset($_GET['id_user']) && $idst == $_GET['id_user']) {
                     $field = new FieldList();
                     $tb->addBodyExpanded($field->playFieldsForUser($idst, false, true), 'user_specific_info');
                 }
             }
         }
         $GLOBALS['page']->add(getTitleArea($this->lang->def('_WAITING_USERS'), 'directory') . '<div class="std_block">' . Form::openForm('waiting_user', 'index.php?modname=directory&amp;op=org_waitinguser') . $tb->getTable() . Form::openButtonSpace() . Form::getButton('ok_waiting', 'ok_waiting', $this->lang->def('_SAVE')) . Form::getButton('cancel_waiting', 'cancel_waiting', $this->lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
     }
 }
Ejemplo n.º 19
0
    /**
     * Add folder dialog
     */
    if ($permissions['add_org']) {
        $this->widget('dialog', array('id' => 'add_folder_dialog', 'dynamicContent' => true, 'ajaxUrl' => 'this.href', 'dynamicAjaxUrl' => true, 'callback' => 'UserManagement.addFolderCallback', 'callEvents' => array(array('caller' => 'add_org_folder', 'event' => 'click'))));
    }
} else {
    echo $_other_links;
}
if ($permissions['view_user']) {
    // Search form
    ?>
<div class="quick_search_form">
	<div class="common_options">
		<?php 
    echo Form::getInputCheckbox('flatview', 'flatview', '1', $show_descendants ? true : false, '') . ' <label class="label_normal" for="flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputCheckbox('show_suspended', 'show_suspended', '1', $show_suspended ? true : false, '') . ' <label class="label_normal" for="show_suspended">' . Lang::t('_SHOW_SUSPENDED', 'organization_chart') . '</label>';
    ?>
	</div>
	<div>
		<a id="usermanagement_filter_selector" href="javascript:;" class="advanced_search">
			<?php 
    echo Lang::t('_ADVANCED_SEARCH', 'standard');
    ?>
		</a>
		<div class="simple_search_box" id="usermanagement_simple_filter_options" style="display: block;">
			<?php 
    echo Form::getInputTextfield("search_t", "filter_text", "filter_text", $filter_text, '', 255, '');
    echo Form::getButton("filter_set", "filter_set", Lang::t('_SEARCH', 'standard'), "search_b");
    echo Form::getButton("filter_reset", "filter_reset", Lang::t('_RESET', 'standard'), "reset_b");
    ?>
		</div>
Ejemplo n.º 20
0
 function loadSelector()
 {
     require_once _base_ . '/lib/lib.tab.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     $file_man = new MyFile(getLogUserId());
     $tab_man = new TabView('myfiles', '');
     $lang =& DoceboLanguage::createInstance('myfiles');
     $areas = $file_man->getFilesAreas();
     while (list($id_page, $area_name) = each($areas)) {
         $new_tab = new TabElemDefault($id_page, $lang->def($area_name), getPathImage('fw') . 'myfiles/' . $id_page . '.gif');
         $tab_man->addTab($new_tab);
     }
     $this->parse();
     $tab_man->parseInput($_POST, $_SESSION);
     $active_tab = $tab_man->getActiveTab();
     if (!$active_tab) {
         $active_tab = importVar('working_area', true, $file_man->getDefaultArea());
         $tab_man->setActiveTab($active_tab);
     }
     $tb = new Table(0, $lang->def('_MYFILES_CAPTION'), $lang->def('_MYFILES_SUMMARY'));
     $cont_h = array('<span class="access-only">' . $lang->def('_FILE_SELECTION') . '</span>', $lang->def('_TITLE') . '</label>');
     $type_h = array('image', '');
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $id_list = array();
     $re_files = $file_man->getFileList($active_tab, false, MYFILE_TITLE);
     while ($file_info = $file_man->fetch_row($re_files)) {
         $id_file = $file_info[MYFILE_ID_FILE];
         $id_list[$id_file] = $id_file;
         $cont = array(Form::getInputCheckbox('new_file_selected_' . $id_file, 'new_file_selected[' . $id_file . ']', $id_file, isset($this->current_selection[$id_file]), ''), '<label for="new_file_selected_' . $id_file . '">' . $file_info[MYFILE_TITLE] . '</label>');
         $tb->addBody($cont);
     }
     // print selector
     $GLOBALS['page']->add(Form::getHidden('working_area', 'working_area', $active_tab) . Form::getHidden('old_selection', 'old_selection', urlencode(serialize($this->current_selection))) . Form::getHidden('displayed', 'displayed', urlencode(serialize($id_list))) . $tab_man->printTabView_Begin('', false) . $tb->getTable() . $tab_man->printTabView_End(), 'content');
 }
Ejemplo n.º 21
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     if ($regroup == 'root') {
         return $this->_getRoot();
     }
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size \r\n\t\tFROM " . $this->table . " \r\n\t\tWHERE regroup = '" . $regroup . "' AND \r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             case "template":
                 //drop down template
                 $templ = getTemplateList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ));
                 break;
             case "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name))) . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . Form::closeFormLine();
                 break;
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 break;
                 //string or int
             //string or int
             default:
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
         }
     }
     return $html;
 }
Ejemplo n.º 22
0
function course()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.table.php';
    require_once _lms_ . '/lib/lib.course.php';
    $GLOBALS['page']->setWorkingZone('content');
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $db =& DbConn::getInstance();
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    // Setup the tree viewer class ----------------------------------------------
    require_once _lms_ . '/lib/folder_tree/class.category_tree.php';
    $treeView = new CategoryFolderTree('courses_categories', true);
    $treeView->useDOMReady = true;
    //to change
    $treeView->isGlobalVariable = true;
    //just for debug purpose
    $treeView->initLibraries();
    $print_tree = $treeView->get();
    // Setup the course table ---------------------------------------------------
    //$man_course = new Man_Course();
    //$course_list = $man_course->getCoursesRequest($table_status['startIndex'], Get::sett('visuItem'), $table_status['sort'], $table_status['dir']);
    //$db->num_rows($course_list),
    //$man_course->getCoursesCountFiltered(),
    if (!isset($_SESSION['course_category']['filter_status'])) {
        $_SESSION['course_category']['filter_status'] = array('c_category' => 0, 'c_filter' => '', 'c_flatview' => false, 'c_waiting' => false);
    }
    $filter_status =& $_SESSION['course_category']['filter_status'];
    if (isset($filter_status['c_flatview']) || isset($filter_status['c_waiting'])) {
        $open = true;
    } else {
        $open = false;
    }
    if (!isset($_SESSION['course_category']['table_status'])) {
        $_SESSION['course_category']['table_status'] = array('startIndex' => 0, 'sort' => 'name', 'dir' => 'asc');
    }
    $table_status =& $_SESSION['course_category']['table_status'];
    // Setup the course table ---------------------------------------------------
    $table_config = array('startIndex' => $table_status['startIndex'], 'results' => Get::sett('visuItem'), 'sort' => $table_status['sort'], 'dir' => $table_status['dir'], 'pageSize' => 0, 'totalRecords' => 0, 'recordsReturned' => array());
    require_once _lms_ . '/lib/table_view/class.coursetableview.php';
    $tableView = new CourseTableView("courses_list");
    $tableView->useDOMReady = true;
    //to change
    $tableView->isGlobalVariable = true;
    //just for debug purpose
    $tableView->initLibraries();
    $tableView->setInitialData($table_config);
    $print_table = $tableView->get();
    //Script for saving data from inline editor
    cout("\n" . '<script type="text/javascript">
			function saveData(callback, newData) {
			var new_value = newData;
			var col = this.getColumn().key;
			var old_value =  this.value;
			var datatable = this.getDataTable();
			var idCourse = this.getRecord().getData("idCourse");

			var myCallback =
			{
				success: function(o)
				{
					var r = YAHOO.lang.JSON.parse(o.responseText);
					if (r.success)
					{
						callback(true, stripSlashes(r.new_value));
					}
					else
					{
						callback(true, stripSlashes(r.old_value));
					}
				},
				failure:
				{
				}
			}

			var post =	"idCourse=" + idCourse
						+"&col=" + col
						+"&new_value=" + new_value
						+"&old_value=" + old_value;

			var url = "ajax.adm_server.php?plf=lms&file=coursetableview&sf=table_view&command=updateField&";

			YAHOO.util.Connect.asyncRequest("POST", url, myCallback, post);
			}
		</script>');
    // Js needed for this page in order to work
    cout("\n" . '<script type="text/javascript">
	//<!--
	course_tree_options = ' . $print_tree['options'] . ';
	-->
	</script>', 'scripts');
    cout("\n" . '<script type="text/javascript">
	//<!--
	course_table_options = ' . $print_table['options'] . ';
	--></script>', 'scripts');
    cout("\n" . '<script type="text/javascript" src="' . Get::rel_path('lms') . '/admin/modules/course/course.js"></script>', 'scripts');
    cout(getTitleArea($lang->def('_COURSES'), 'course') . '<div class="std_block">' . (isset($_GET['result']) ? guiResultStatus($lang, $_GET['result']) : ''), 'content');
    // Show tree
    cout('<h2>' . $lang->def('_CATEGORY') . '</h2>' . $print_tree['html'] . '<div class="folder_action_space">' . '<a id="add_folder_button" class="ico-wt-sprite subs_add" href="#"><span>' . $lang->def('_NEW_CATEGORY') . '</span></a>' . '</div>', 'content');
    // Show filter
    cout('<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('c_flatview', 'c_flatview', '1', $filter_status['c_flatview'] ? true : false, '') . ' <label class="label_normal" for="c_flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputCheckbox('c_waiting', 'c_waiting', '1', $filter_status['c_waiting'] ? true : false, '') . ' <label class="label_normal" for="c_waiting">' . Lang::t('_WAITING_USERS', 'organization_chart') . '</label>' . '</div>' . '<br />' . '<div>' . Form::openForm('course_filters', 'index.php?modname=course&amp;op=course_list') . Form::getInputTextfield("search_t", "c_filter", "c_filter", $filter_status['c_filter'], '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("c_filter_reset", "c_filter_reset", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>' . '</div>', 'content');
    // show course table
    cout('' . '<div class="table-container-over">' . (checkPerm('add', true, 'course', 'lms') ? '<a class="ico-wt-sprite subs_add" href="index.php?modname=course&amp;op=new_course"><span>' . $lang->def('_NEW_COURSE') . '</span></a>' : '') . (checkPerm('subscribe', true, 'course', 'lms') ? '&nbsp;&nbsp;<a class="ico-wt-sprite subs_users" href="index.php?r=alms/subscription/multiplesubscription&amp;load=1"><span>' . Lang::t('_MULTIPLE_SUBSCRIPTION', 'course') . '</span></a>' : '') . '</div>' . $print_table['html'] . '<div class="table-container-below">' . (checkPerm('add', true, 'course', 'lms') ? '<a class="ico-wt-sprite subs_add" href="index.php?modname=course&amp;op=new_course"><span>' . $lang->def('_NEW_COURSE') . '</span></a>' : '') . (checkPerm('subscribe', true, 'course', 'lms') ? '&nbsp;&nbsp;<a class="ico-wt-sprite subs_users" href="index.php?r=alms/subscription/multiplesubscription&amp;load=1"><span>' . Lang::t('_MULTIPLE_SUBSCRIPTION', 'course') . '</span></a>' : '') . '</div>', 'content');
    //set event listeners to filter elements
    cout('<script type="text/javascript">$E=YAHOO.util.Event; $E.onDOMReady( function(e) {
			$E.addListener("c_filter_set", "click", filterEvent);
			$E.addListener("c_filter_reset", "click", function() { YAHOO.util.Dom.get("c_filter").value=""; filterEvent; });
			$E.addListener("c_flatview", "click", filterEvent);
			$E.addListener("c_waiting", "click", filterEvent);
			$E.addListener("course_filters", "submit", function(ev) { filterEvent(ev); YAHOO.util.Event.preventDefault(ev); });
		});</script>', 'scripts');
    cout('</div>', 'content');
}
Ejemplo n.º 23
0
			_MOD: "<?php 
echo Lang::t('_MOD', 'standard');
?>
"
		}
	};
	Competences.init(oConfig);
});
</script>
<div class="std_block">

<div class="quick_search_form">
	<div>
		<div class="simple_search_box" id="competences_simple_filter_options" style="display: block;">
			<?php 
echo Form::getInputCheckbox('show_descendants', 'show_descendants', '1', $show_descendants ? true : false, '') . ' <label class="label_normal" for="show_descendants">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>';
echo '&nbsp;&nbsp;';
echo Form::getInputTextfield("search_t", "filter_text", "filter_text", $filter_text, '', 255, '');
echo Form::getButton("filter_set", "filter_set", Lang::t('_SEARCH', 'standard'), "search_b");
echo Form::getButton("filter_reset", "filter_reset", Lang::t('_RESET', 'standard'), "reset_b");
?>
		</div>
	</div>
</div>

<div class="panel_left_small">
<span class="title"><?php 
echo Lang::t('_ALL_CATEGORIES', 'competences');
?>
</span>
<?php 
Ejemplo n.º 24
0
 /**
  * @param string	$base_path 		if specified load only preference form this base_path
  * @param bool		$only_visible 	if true only the visible
  *
  * @return string	the code for the mod mask
  */
 function getModifyMask($base_path = false, $only_visible = true, $separate_output = false)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('preferences', 'framework');
     $preferences = $this->_up_db->getFullPreferences($this->id_user, $only_visible, false, $base_path);
     $html = array();
     while (list(, $pref) = each($preferences)) {
         // Navigation trought the preferences
         // array( 'path_name', 'label', 'default_value', 'type', 'visible', 'load_at_startup', 'user_value' )
         switch ($pref['type']) {
             case "language":
                 //drop down language
                 $lang_sel = $this->getLanguage();
                 $langs_var = Docebo::langManager()->getAllLangCode();
                 $langs = array();
                 foreach ($langs_var as $k => $v) {
                     $langs[$k] = $v;
                 }
                 /* XXX: remove when alll lang ready*/
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $langs, array_search($lang_sel, $langs));
                 break;
             case "template":
                 //drop down template
                 $templ_sel = $this->getTemplate();
                 $templ = getTemplateList();
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $templ, array_search($templ_sel, $templ));
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $ht_edit, $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
                 break;
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $layout, $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
                 break;
             case "enum":
                 //on off
                 $value = $pref['user_value'] ? $pref['user_value'] : $pref['default_value'];
                 $html[$pref['path_name']] = Form::openFormLine() . Form::getInputCheckbox($this->base_name . '_' . $pref['path_name'] . '_on', $this->base_name . '[' . $pref['path_name'] . ']', 'on', $value == 'on', '') . ' ' . Form::getLabel($this->base_name . '_' . $pref['path_name'] . '_on', $lang->def($pref['label'])) . Form::closeFormLine();
                 break;
                 //string or int
             //string or int
             default:
                 $html[$pref['path_name']] = Form::getTextfield($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', '65535', $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
         }
     }
     return $separate_output ? $html : implode("", $html) . '<div class="nofloat"></div>';
 }
Ejemplo n.º 25
0
 function loadCoursepathSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $output = '';
     // Filter
     $this->filter['coursepath_name'] = isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '';
     if ($this->show_filter === true) {
         /*
         			$form = new Form();
         			$output .= $form->getOpenFieldset($lang->def('_COURSEPATH_FILTER'))
         				.Form::getTextfield($lang->def('_NAME'), 'coursepath_filter_name', 'coursepath_filter_name', '255',
         					( isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '' ))
         				.$form->openButtonSpace()
         				.$form->getButton('coursepath_filter', 'coursepath_filter', $lang->def('_SEARCH'))
         				.$form->closeButtonSpace()
         				.$form->getCloseFieldset();*/
         $output .= '<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "coursepath_filter_name", "coursepath_filter_name", Get::req('coursepath_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("coursepath_filter", "coursepath_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_SUMMARY'));
     $tb->initNavBar('ini_cpath', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT id_path, path_name, path_descr ";
     $query_coursepath = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE 1 ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             $query = "SELECT id_path" . " FROM %lms_coursepath_user" . " WHERE idUser = '******'";
             $result = sql_query($query);
             $admin_courses['coursepath'] = array();
             while (list($id_path) = sql_fetch_row($result)) {
                 $admin_courses['coursepath'][$id_path] = $id_path;
             }
             if (!empty($admin_courses['coursepath']) && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['coursepath'])) {
                 $query_coursepath .= " AND 0 ";
             } else {
                 $query_coursepath .= " AND id_path IN (" . implode(',', $admin_courses['coursepath']) . ") ";
             }
         }
     }
     if ($this->filter['coursepath_name'] != '') {
         $query_coursepath .= " AND path_name LIKE '%" . $this->filter['coursepath_name'] . "%'";
     }
     list($tot_coursepath) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_coursepath));
     $query_coursepath .= "\r\n\t\tORDER BY path_name\r\n\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_coursepath = sql_query($select . $query_coursepath);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_SELECT') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_path, $name, $descr) = sql_fetch_row($re_coursepath)) {
         $tb_content = array(Form::getInputCheckbox('new_coursepath_selected_' . $id_path, 'new_coursepath_selected[' . $id_path . ']', $id_path, isset($this->current_selection[$id_path]), ''), '<label for="new_coursepath_selected_' . $id_path . '">' . $name . '</label>', '<label for="new_coursepath_selected_' . $id_path . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_path])) {
             unset($this->current_selection[$id_path]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_coursepath) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Ejemplo n.º 26
0
 public function getPresenceTable()
 {
     $user = $this->classroom_man->getUserForPresence($this->id_date);
     $day = $this->getDateDay($this->id_date);
     $test_type = $this->getTestType();
     $user_presence = $this->classroom_man->getUserPresenceForDate($this->id_date);
     $tb = new Table(0, Lang::t('_ATTENDANCE', 'course'), Lang::t('_ATTENDANCE', 'course'));
     $cont_h = array(Lang::t('_USERNAME', 'course'), Lang::t('_FULLNAME', 'course'));
     $type_h = array('', '');
     foreach ($day as $id_day => $day_info) {
         $cont_h[] = Format::date($day_info['date_begin'], 'date') . '<br />' . '<a href="javascript:;" onClick="checkAllDay(' . $id_day . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_DAY', 'presence') . '</a>') . ' ' . '<a href="javascript:;" onClick="unCheckAllDay(' . $id_day . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_DAY', 'presence') . '</a>');
         $type_h[] = 'img-cell';
     }
     $cont_h[] = '';
     $type_h[] = 'img-cell';
     if ($test_type == _DATE_TEST_TYPE_PAPER) {
         $cont_h[] = Lang::t('_SCORE', 'course');
         $type_h[] = 'img-cell';
     }
     $cont_h[] = Lang::t('_NOTES', 'course');
     $type_h[] = 'img-cell';
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $array_user_id = array();
     foreach ($user as $id_user => $user_info) {
         reset($day);
         $array_user_id[] = $id_user;
         $cont = array();
         $cont[] = $user_info['userid'];
         $cont[] = $user_info['lastname'] . ' ' . $user_info['firstname'];
         foreach ($day as $id_day => $day_info) {
             if (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 1) {
                 $presence = true;
             } elseif (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 0) {
                 $presence = false;
             } else {
                 $presence = false;
             }
             $cont[] = Form::getInputCheckbox('date_' . $id_day . '_' . $id_user, 'date_' . $id_day . '_' . $id_user, 1, $presence, false);
         }
         $cont[] = '<a href="javascript:;" onClick="checkAllUser(' . $id_user . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_USER', 'presence') . '</a>') . '<br />' . '<a href="javascript:;" onClick="unCheckAllUser(' . $id_user . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_USER', 'presence') . '</a>');
         if ($test_type == _DATE_TEST_TYPE_PAPER) {
             if (isset($user_presence[$id_user]['0000-00-00']) && $user_presence[$id_user]['0000-00-00']['presence'] == 1) {
                 $passed = true;
             } else {
                 $passed = false;
             }
             //$cont[] = Form::getTextfield('', 'score_'.$id_user, 'score_'.$id_user, 255, (isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0'));
             $cont[] = Form::getInputTextfield('', 'score_' . $id_user, 'score_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0', Lang::t('_SCORE', 'course'), 255, '');
         }
         //$cont[] = Form::getSimpleTextarea('', 'note_'.$id_user, 'note_'.$id_user, (isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : ''), false, false, false, 2);
         $cont[] = Form::getInputTextarea('note_' . $id_user, 'note_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : '', '', 5, 22);
         $tb->addBody($cont);
     }
     return $tb->getTable();
 }
Ejemplo n.º 27
0
 function loadCatalogueSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     // Filter
     $this->filter['catalogue_name'] = isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '';
     if ($this->show_filter === true) {
         $form = new Form();
         /*$GLOBALS['page']->add(
         			$form->getOpenFieldset($lang->def('_SEARCH'))
         			.Form::getTextfield($lang->def('_NAME'), 'cat_filter_name', 'cat_filter_name', '255',
         				( isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '' ))
         			.$form->openButtonSpace()
         			.$form->getButton('catalogue_filter', 'catalogue_filter', $lang->def('_SEARCH'))
         			.$form->closeButtonSpace()
         			.$form->getCloseFieldset()
         		, 'content');
         		*/
         cout('<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "cat_filter_name", "cat_filter_name", Get::req('cat_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("catalogue_filter", "catalogue_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>', 'content');
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CATALOGUE'), $lang->def('_CATALOGUE_SUMMARY'));
     $tb->initNavBar('ini_cat', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT c.idCatalogue, c.name, c.description";
     $query_catalogue = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue AS c\r\n\t\tWHERE 1";
     // Retriving data
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['catalogue'])) {
                 $query_catalogue .= " AND 0 ";
             } else {
                 $query_catalogue .= " AND c.idCatalogue IN (0," . implode(',', $admin_courses['catalogue']) . ") ";
             }
         }
     }
     if ($this->filter['catalogue_name'] != '') {
         $query_catalogue .= " AND c.name LIKE '%" . $this->filter['catalogue_name'] . "%'";
     }
     list($tot_catalogue) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_catalogue));
     $query_catalogue .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_catalogue = sql_query($select . $query_catalogue);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_CATALOGUE_SELECTION') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_catalogue, $name, $descr) = sql_fetch_row($re_catalogue)) {
         $tb_content = array(Form::getInputCheckbox('new_catalogue_selected_' . $id_catalogue, 'new_catalogue_selected[' . $id_catalogue . ']', $id_catalogue, isset($this->current_selection[$id_catalogue]), ''), '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $name . '</label>', '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_catalogue])) {
             unset($this->current_selection[$id_catalogue]);
         }
     }
     $output = $tb->getTable() . $tb->getNavBar($ini, $tot_catalogue) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Ejemplo n.º 28
0
<?php

Get::title(array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), 'index.php?r=' . $base_link_classroom . '/classroom&id_course=' . $model->getIdCourse() => Lang::t('_CLASSROOM', 'course'), Lang::t('_ADD', 'course')));
if (isset($err_avail)) {
    echo UIFeedback::error(Lang::t($err_avail, 'course'));
}
?>
<div class="std_block">

<?php 
echo Form::openForm('add_date', 'index.php?r=' . $base_link_classroom . '/addclassroom&amp;id_course=' . $model->getIdCourse()) . Form::getHidden('step', 'step', '2') . Form::openElementSpace() . Form::getTextfield(Lang::t('_CODE', 'course'), 'code', 'code', 255, isset($_POST['code']) ? $_POST['code'] : $course_info['code']) . Form::getTextfield(Lang::t('_NAME', 'course'), 'name', 'name', 255, isset($_POST['name']) ? $_POST['name'] : $course_info['name']) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'description', 'description', isset($_POST['description']) ? stripslashes(stripslashes($_POST['description'])) : stripslashes($course_info['description'])) . Form::getTextfield(Lang::t('_MEDIUM_TIME', 'course'), 'medium_time', 'medium_time', 255, isset($_POST['medium_time']) ? $_POST['medium_time'] : $course_info['mediumTime']) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_par', 'max_par', 255, isset($_POST['max_par']) ? $_POST['max_par'] : '') . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'price', 'price', 255, isset($_POST['price']) ? $_POST['price'] : '') . Form::getDropdown(Lang::t('_STATUS', 'course'), 'status', 'status', $model->getStatusForDropdown(), isset($_POST['status']) ? $_POST['status'] : '') . Form::getDropdown(Lang::t('_FINAL_SCORE', 'course'), 'test', 'test', $model->getTestTypeForDropdown(), isset($_POST['test']) ? $_POST['test'] : '') . '<div class="form_line_l">' . '<p><label for="overbooking" class="floating">' . Lang::t('_ALLOW_OVERBOOKING', 'course') . '</label></p>' . Form::getInputCheckbox('overbooking', 'overbooking', 1, isset($_POST['overbooking']) && $_POST['overbooking'] == 1 ? true : false, false) . '</div>' . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course'), 'sub_start_date', 'sub_start_date', isset($_POST['sub_start_date']) ? $_POST['sub_start_date'] === '00-00-0000' ? '' : $_POST['sub_start_date'] : '') . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course'), 'sub_end_date', 'sub_end_date', isset($_POST['sub_end_date']) ? $_POST['sub_end_date'] === '00-00-0000' ? '' : $_POST['sub_end_date'] : '') . Form::getDatefield(Lang::t('_UNSUBSCRIBE_DATE_LIMIT', 'course'), 'unsubscribe_date_limit', 'unsubscribe_date_limit', isset($_POST['unsubscribe_date_limit']) ? $_POST['unsubscribe_date_limit'] === '00-00-0000' ? '' : $_POST['unsubscribe_date_limit'] : '') . '<div id="date_container">';
?>

<div id="calendar_container" class="form_line_l"></div>

<?php 
$date_string = '';
$start_mounth = '';
if (isset($_POST['date_selected']) && !empty($_POST['date_selected'])) {
    $array_day = explode(',', $_POST['date_selected']);
    $first = true;
    if (count($array_day) > 0) {
        for ($i = 0; $i < count($array_day); $i++) {
            if ($first) {
                $first = false;
                $start_mounth = (int) substr($array_day[$i], 5, 2) . '/' . substr($array_day[$i], 0, 4);
                $date_string .= (int) substr($array_day[$i], 5, 2) . '/' . (int) substr($array_day[$i], 8, 2) . '/' . substr($array_day[$i], 0, 4);
            } else {
                $date_string .= ',' . (int) substr($array_day[$i], 5, 2) . '/' . (int) substr($array_day[$i], 8, 2) . '/' . substr($array_day[$i], 0, 4);
            }
        }
Ejemplo n.º 29
0
Get::title(array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), $id_course === false ? Lang::t('_NEW_COURSE', 'course') : Lang::t('_MOD', 'course') . ': ' . ($course['code'] !== '' ? '[' . $course['code'] . '] ' : '') . $course['name']));
?>
<div class="std_block">
	<?php 
echo Form::openForm('maskcourse_form', 'index.php?r=' . $base_link_course . '/' . ($id_course === false ? 'newcourse' : 'modcourse'), false, 'post', 'multipart/form-data') . Form::getHidden('id_course', 'id_course', $id_course) . Form::openElementSpace() . ($id_course === false ? Form::getLineBox(Lang::t('_CATEGORY_SELECTED', 'course'), $name_category) . Form::getHidden('idCategory', 'idCategory', $_SESSION['course_category']['filter_status']['id_category']) : Form::getDropdown(Lang::t('_CATEGORY_SELECTED', 'course'), 'idCategory', 'idCategory', $model->getCategoryForDropdown(), $course['idCategory'])) . Form::getTextfield(Lang::t('_CODE', 'course'), 'course_code', 'course_code', '50', $course['code']) . Form::getTextfield(Lang::t('_COURSE_NAME', 'course'), 'course_name', 'course_name', '255', $course['name']);
if ($course['course_type'] == 'classroom' && $has_editions_or_classrooms) {
    //this is a classroom course with editions
    echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['classroom']) . Form::getHidden('course_type', 'course_type', 'classroom');
} elseif ($course['course_edition'] > 0 && $has_editions_or_classrooms) {
    //this is a classroom course with editions
    echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['edition']) . Form::getHidden('course_type', 'course_type', 'edition');
} else {
    //echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $course['course_type']);
    echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $id_course === false ? 'elearning' : $course['course_type']);
}
echo Form::getDropdown(Lang::t('_STATUS', 'course'), 'course_status', 'course_status', $status, $course['status']) . Form::getCheckbox(Lang::t('_DIRECT_PLAY', 'course'), 'direct_play', 'direct_play', '1', $course['direct_play'] == 1) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'course_descr', 'course_descr', $course['description']) . ($id_course !== false && $course['course_type'] != 'elearning' ? Form::getCheckbox(Lang::t('_CASCADE_MOD_ON_EDITION', 'course'), 'cascade_on_ed', 'cascade_on_ed', 1) : '') . Form::closeElementSpace() . Form::openElementSpace() . Form::openCollasableFieldset(Lang::t('_DETAILS', 'course')) . ($id_course === false ? Form::getDropdown(Lang::t('_COURSE_MENU_TO_ASSIGN', 'course'), 'selected_menu', 'selected_menu', $menu_custom, $sel_custom) : '') . Form::getDropdown(Lang::t('_COURSE_LANG_METHOD', 'course'), 'course_lang', 'course_lang', $array_lang, array_search($course['lang_code'], $array_lang)) . Form::getDropdown(Lang::t('_DIFFICULTY', 'course'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . Form::getTextfield(Lang::t('_CREDITS', 'course'), 'credits', 'credits', '50', $course['credits']) . Form::getDropdown(Lang::t('_LABELS', 'label'), 'label', 'label', $label_model->getLabelFromDropdown(true), $id_course === false ? false : $label_model->getCourseLabel($course['idCourse'])) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SUBSCRIPTION', 'course')) . Form::getOpenCombo(Lang::t('_COURSE_SUBSRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'course_subs_godadmin', 'course_subs', '0', $course['subscribe_method'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'course_subs_moderate', 'course_subs', '1', $course['subscribe_method'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'course_subs_free', 'course_subs', '2', $course['subscribe_method'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_USER_CAN_SUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_SUBSCRIPTION_CLOSED', 'course'), 'subscription_closed', 'can_subscribe', '0', $course['can_subscribe'] == 0) . Form::getRadio(Lang::t('_SUBSCRIPTION_OPEN', 'course'), 'subscription_open', 'can_subscribe', '1', $course['can_subscribe'] == 1) . Form::getRadio(Lang::t('_SUBSCRIPTION_IN_PERIOD', 'course') . ":", 'subscription_period', 'can_subscribe', '2', $course['can_subscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course') . ":", 'sub_start_date', 'sub_start_date', $course['sub_start_date']) . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course') . ":", 'sub_end_date', 'sub_end_date', $course['sub_end_date']) . Form::getBreakRow() . Form::getOpenCombo(Lang::t('_USER_CAN_UNSUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'no_user_unsubscription', 'auto_unsubscribe', '0', $course['auto_unsubscribe'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'moderated_user_unsubscription', 'auto_unsubscribe', '1', $course['auto_unsubscribe'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'yes_user_unsubscription', 'auto_unsubscribe', '2', $course['auto_unsubscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_UNSUBSCRIBE_DATE_LIMIT', 'course'), 'unsubscribe_date_limit', 'unsubscribe_date_limit', $unsubscribe_date_limit, FALSE, FALSE, '', '', Form::getInputCheckbox('use_unsubscribe_date_limit', 'use_unsubscribe_date_limit', 1, $use_unsubscribe_date_limit, '') . ' ') . Form::getBreakRow() . Form::getTextfield(Lang::t('_COURSE_AUTOREGISTRATION_CODE', 'course'), 'course_autoregistration_code', 'course_autoregistration_code', '255', $course['autoregistration_code']) . Form::getCheckbox(Lang::t('_RANDOM_COURSE_AUTOREGISTRATION_CODE', 'course'), 'random_course_autoregistration_code', 'random_course_autoregistration_code', 0) . Form::getBreakRow() . Form::getCheckbox(Lang::t('_COURSE_SELL', 'course'), 'course_sell', 'course_sell', '1', $course['selling'] == 1) . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'course_prize', 'course_prize', '11', $course['prize']) . Form::getTextfield(Lang::t('_COURSE_ADVANCE', 'course'), 'advance', 'advance', '11', $course['advance']) . Form::getHidden('course_em', 'course_em', '0') . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_DISPLAY_MODE', 'course')) . Form::getOpenCombo(Lang::t('_WHERE_SHOW_COURSE', 'course')) . Form::getRadio(Lang::t('_SC_EVERYWHERE', 'course'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . Form::getRadio(Lang::t('_SC_ONLY_IN', 'course'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . Form::getRadio(Lang::t('_SC_ONLYINSC_USER', 'course'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_WHAT_SHOW', 'course')) . Form::getCheckbox(Lang::t('_SHOW_PROGRESS', 'course'), 'course_progress', 'course_progress', '1', $course['show_progress'] == 1) . Form::getCheckbox(Lang::t('_SHOW_TIME', 'course'), 'course_time', 'course_time', '1', $course['show_time'] == 1) . Form::getCheckbox(Lang::t('_SHOW_ADVANCED_INFO', 'course'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info'] == 1) . Form::getCloseCombo() . Form::getDropdown(Lang::t('_SHOW_WHOISONLINE', 'course'), 'show_who_online', 'show_who_online', $show_who_online, $course['show_who_online']) . Form::getOpenCombo(Lang::t('_SHOW_USER_OF_LEVEL', 'course'));
while (list($level, $level_name) = each($levels)) {
    echo Form::getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level);
}
echo Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_COURSE_STATUS_CANNOT_ENTER', 'course')) . Form::getCheckbox(Lang::t('_USER_STATUS_SUBS', 'course'), 'user_status_' . _CUS_SUBSCRIBED, 'user_status[' . _CUS_SUBSCRIBED . ']', _CUS_SUBSCRIBED, $course['userStatusOp'] & 1 << _CUS_SUBSCRIBED) . Form::getCheckbox(Lang::t('_USER_STATUS_BEGIN', 'course'), 'user_status_' . _CUS_BEGIN, 'user_status[' . _CUS_BEGIN . ']', _CUS_BEGIN, $course['userStatusOp'] & 1 << _CUS_BEGIN) . Form::getCheckbox(Lang::t('_USER_STATUS_END', 'course'), 'user_status_' . _CUS_END, 'user_status[' . _CUS_END . ']', _CUS_END, $course['userStatusOp'] & 1 << _CUS_END) . Form::getCheckbox(Lang::t('_USER_STATUS_SUSPEND', 'course'), 'user_status_' . _CUS_SUSPEND, 'user_status[' . _CUS_SUSPEND . ']', _CUS_SUSPEND, $course['userStatusOp'] & 1 << _CUS_SUSPEND) . Form::getCloseCombo() . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_TIME_OPTION', 'course')) . Form::getDatefield(Lang::t('_DATE_BEGIN', 'course'), 'course_date_begin', 'course_date_begin', $course['date_begin']) . Form::getDatefield(Lang::t('_DATE_END', 'course'), 'course_date_end', 'course_date_end', $course['date_end']) . Form::getLineBox('<label for="hour_begin_hour">' . Lang::t('_HOUR_BEGIN', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qe_sel, '')) . Form::getLineBox('<label for="hour_end_hour">' . Lang::t('_HOUR_END', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . Form::getTextfield(Lang::t('_DAY_OF_VALIDITY', 'course'), 'course_day_of', 'course_day_of', '10', $course['valid_time']) . Form::getTextfield(Lang::t('_MEDIUM_TIME', 'course'), 'course_medium_time', 'course_medium_time', '10', $course['mediumTime']) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SPECIAL_OPTION', 'course')) . Form::getTextfield(Lang::t('_MIN_NUM_SUBSCRIBE', 'course'), 'min_num_subscribe', 'min_num_subscribe', '11', $course['min_num_subscribe']) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_num_subscribe', 'max_num_subscribe', '11', $course['max_num_subscribe']) . Form::getCheckbox(Lang::t('_ALLOW_OVERBOOKING', 'course'), 'allow_overbooking', 'allow_overbooking', '1', $course['allow_overbooking'] == 1) . Form::getTextfield(Lang::t('_COURSE_QUOTA', 'course'), 'course_quota', 'course_quota', '11', $course['course_quota'] != COURSE_QUOTA_INHERIT ? $course['course_quota'] : 0) . Form::getCheckbox(Lang::t('_INHERIT_QUOTA', 'course'), 'inherit_quota', 'inherit_quota', '1', $course['course_quota'] == COURSE_QUOTA_INHERIT) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_DOCUMENT_UPLOAD', 'course')) . Form::getTextfield(Lang::t('_SPONSOR_LINK', 'course'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . Form::getExtendedFilefield(Lang::t('_PATHSPONSOR', 'configuration'), 'course_sponsor_logo', 'course_sponsor_logo', $course["imgSponsor"]) . Form::getExtendedFilefield(Lang::t('_COURSE_LOGO', 'course'), 'course_logo', 'course_logo', $course["img_course"]) . Form::getExtendedFilefield(Lang::t('_COURSE_DEMO', 'course'), 'course_demo', 'course_demo', $course["course_demo"]) . Form::getCheckbox(Lang::t('_USE_LOGO_IN_COURSELIST', 'course'), 'use_logo_in_courselist', 'use_logo_in_courselist', 1, $course["use_logo_in_courselist"]) . Form::getCloseFieldset() . Form::closeElementSpace() . Form::openButtonSpace() . ($_REQUEST['r'] == 'alms/course/newcourse' || $_REQUEST['r'] == 'alms/course/modcourse' && $row[0] == 0 ? Form::getCheckbox(Lang::t('_AUTO_SUBSCRIPTION'), 'auto_subscription', 'auto_subscription', '1', true) : '') . Form::getButton('save', 'save', Lang::t('_SAVE')) . Form::getButton('undo', 'undo', Lang::t('_UNDO')) . Form::closeButtonSpace() . Form::closeForm();
?>
</div>
<script type="text/javascript">
var D = YAHOO.util.Dom, E = YAHOO.util.Event;
E.onDOMReady(function() {
	var c = D.get("use_unsubscribe_date_limit"), d = D.get("unsubscribe_date_limit");
	E.addListener("no_user_unsubscription", "click", function(e) {
		var checked = this.checked;
		c.disabled = checked;
		d.disabled = checked;
	});
Ejemplo n.º 30
0
$mask .= $_close_cell . $_open_cell;
$mask .= Form::getDropdown(Lang::t('_LEVEL', 'admin_directory'), 'level', 'level', $levels, $info['level']);
$mask .= $_close_cell . $_close_row;
/*
foreach ($modify_mask as $id_item => $item) {
	$mask .= $_open_row.$_open_cell;
	$mask .= Form::getInputCheckbox('multimod_selpref_'.$id_item, 'multimod_selpref['.$id_item.']', 1, false, "");
	$mask .= $_close_cell.$_open_cell;
	$mask .= $item;
	$mask .= $_close_cell.$_close_row;
}
*/
foreach ($fields_mask as $id_item => $item) {
    if (!in_array($id_item, $fields_to_exclude)) {
        $mask .= $_open_row . $_open_cell;
        $mask .= Form::getInputCheckbox('multimod_selfield_' . $id_item, 'multimod_selfield[' . $id_item . ']', 1, false, "");
        $mask .= $_close_cell . $_open_cell;
        $mask .= $item;
        $mask .= $_close_cell . $_close_row;
    }
}
/* $social =new Social();
if ($social->isActive('facebook')) {
	$mask .= $_open_row.$_open_cell;
	$mask .= Form::getInputCheckbox('multimod_sel_facebook_id', 'multimod_sel[facebook_id]', 1, false, "");
	$mask .= $_close_cell.$_open_cell;
	$mask .= Form::getTextField(Lang::t('_FACEBOOK_ID', 'standard'), 'facebook_id', 'facebook_id', 255, $info['facebook_id']);
	$mask .= $_close_cell.$_close_row;
}

if ($social->isActive('twitter')) {