Example #1
0
<?php

if (isset($id_questcategory)) {
    $_form_id = 'mod_questcategory_form';
    $_form_action = 'ajax.adm_server.php?r=alms/questcategory/edit_action';
    $_title = Lang::t('_MOD', 'standard');
} else {
    $_form_id = 'add_questcategory_form';
    $_form_action = 'ajax.adm_server.php?r=alms/questcategory/create_action';
    $_title = Lang::t('_ADD', 'standard');
}
$_body = "";
$_body .= Form::openForm($_form_id, $_form_action);
//if we are editing an existent role, print its id
if (isset($id_questcategory)) {
    $_body .= Form::getHidden('id_questcategory', 'id', $id_questcategory);
}
$_body .= Form::getTextfield(Lang::t('_NAME', 'standard'), 'name_questcategory', 'name', 255, isset($name) ? $name : "");
$_body .= Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'standard'), 'description_questcategory', 'description', isset($description) ? $description : "");
$_body .= Form::closeForm();
//send output
if (isset($json)) {
    $params = array('success' => true, 'header' => $_title, 'body' => $_body);
    echo $json->encode($params);
} else {
    echo getTitleArea($_title);
    echo $_body;
}
Example #2
0
<?php

echo getTitleArea(array('index.php?r=alms/label/show' => Lang::t('_LABELS', 'label'), Lang::t('_MOD', 'label')));
?>
<div class="std_block">
<?php 
echo Form::openForm('mod_label_form', 'index.php?r=alms/label/mod&amp;id_common_label=' . $id_common_label, false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getFilefield(Lang::t('_IMAGE', 'label'), 'label_image', 'label_image') . ($model->getLabelFile($id_common_label) !== '' ? '<img style="height: 48px;" src="' . $GLOBALS['where_files_relative'] . '/appLms/label/' . $model->getLabelFile($id_common_label) . '" />' . Form::getCheckbox(Lang::t('_DEL_LABEL_IMAGE', 'label'), 'del_label_image', 'del_label_image', false) : '');
?>
<div id="label_edit" class="yui-navset">
	<ul class="yui-nav">
		<?php 
foreach ($all_languages as $lang_code) {
    echo '<li' . ($lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $lang_code . '"><em>' . $lang_code . '</em></a>' . '</li>';
}
?>
	</ul>
	<div class="yui-content">
		<?php 
foreach ($all_languages as $lang_code) {
    echo '<div id="langs_tab_' . $lang_code . '">' . Form::getTextfield(Lang::t('_TITLE', 'label'), $lang_code . '_title', $lang_code . '_title', 255, isset($label_info[$lang_code]) ? $label_info[$lang_code][LABEL_TITLE] : '') . Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'label'), $lang_code . '_description', $lang_code . '_description', isset($label_info[$lang_code]) ? $label_info[$lang_code][LABEL_DESCRIPTION] : '') . '</div>';
}
?>
	</div>
</div>
<script type="text/javascript">
	new YAHOO.widget.TabView("label_edit");
</script>
<?php 
echo Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('update', 'update', Lang::t('_UPDATE', 'label')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'label')) . Form::closeButtonSpace() . Form::closeForm();
?>
</div>
Example #3
0
 function editGroup($groupid = FALSE)
 {
     require_once _base_ . '/lib/lib.form.php';
     if ($groupid === FALSE || $groupid === '') {
         $groupid = importVar('groupid', FALSE, '');
         $groupLabel = importVar('groupid', FALSE, $this->lang->def('_DIRECTORY_NEWGROUP'));
     } else {
         $groupLabel = $groupid;
     }
     $description = '';
     $idst = '';
     $type = 'free';
     $show_on_platform = array();
     if ($groupid != '') {
         $arrGroup = $this->aclManager->getGroup(FALSE, $groupid);
         if ($arrGroup !== FALSE) {
             $idst = $arrGroup[0];
             $description = $arrGroup[2];
             $type = $arrGroup[4];
             $show_on_platform = array_flip(explode(',', $arrGroup[5]));
         }
     }
     $all_group_type = array('free' => $this->lang->def('_DIRECTORY_GROUPTYPE_FREE'), 'moderate' => $this->lang->def('_DIRECTORY_GROUPTYPE_MODERATE'), 'private' => $this->lang->def('_DIRECTORY_GROUPTYPE_PRIVATE'), 'invisible' => $this->lang->def('_DIRECTORY_GROUPTYPE_INVISIBLE'));
     $GLOBALS['page']->add(getTitleArea($this->lang->def('_GROUPS') . ': ' . $groupLabel, 'directory_group'), 'content');
     $GLOBALS['page']->add('<div class="std_block">', 'content');
     $GLOBALS['page']->add(Form::getFormHeader($this->lang->def('_DEL')), 'content');
     $GLOBALS['page']->add(Form::openForm('directoryeditgroup', 'index.php?modname=directory&amp;op=listgroup'), 'content');
     $GLOBALS['page']->add(Form::openElementSpace(), 'content');
     $GLOBALS['page']->add(Form::getOpenFieldset($this->lang->def('_DEL') . ' - ' . $groupLabel), 'content');
     $GLOBALS['page']->add(Form::getTextfield($this->lang->def('_DIRECTORY_GROUPID'), "groupid", "groupid", 50, $groupid), 'content');
     $GLOBALS['page']->add(Form::getSimpleTextarea($this->lang->def('_DESCRIPTION'), "description", "description", $description), 'content');
     $GLOBALS['page']->add(Form::getHidden('idst', 'idst', $idst), 'content');
     $GLOBALS['page']->add(Form::getDropdown($this->lang->def('_DIRECTORY_GROUPTYPE'), 'group_type', 'group_type', $all_group_type, $type), 'content');
     $GLOBALS['page']->add(Form::getCloseFieldset(), 'content');
     $GLOBALS['page']->add(Form::getOpenFieldset($this->lang->def('_DIRECTORY_GROUP_VISIBLE')), 'content');
     $plt_man = PlatformManager::createInstance();
     $plt_list = $plt_man->getPlatformList(true);
     $GLOBALS['page']->add(Form::getHidden('show_on_platform_framework', 'show_on_platform[framework]', 1), 'content');
     while (list($code, $name) = each($plt_list)) {
         $GLOBALS['page']->add(Form::getCheckbox($name, 'show_on_platform_' . $code, 'show_on_platform[' . $code . ']', 1, isset($show_on_platform[$code])), 'content');
     }
     $GLOBALS['page']->add(Form::getCloseFieldset(), 'content');
     $GLOBALS['page']->add(Form::closeElementSpace(), 'content');
     $GLOBALS['page']->add(Form::openButtonSpace(), 'content');
     $GLOBALS['page']->add(Form::getButton("editgroupsave", "editgroupsave", $this->lang->def('_SAVE')), 'content');
     $GLOBALS['page']->add(Form::getButton("editgroupcancel", "editgroupcancel", $this->lang->def('_CANCEL')), 'content');
     $GLOBALS['page']->add(Form::closeButtonSpace(), 'content');
     $GLOBALS['page']->add(Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }
function modAssignMetaCertificate()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $id_certificate = Get::req('id_certificate', DOTY_INT, 0);
    $id_meta = Get::req('idmeta', DOTY_INT, 0);
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $form = new Form();
    if (isset($_POST['confirm'])) {
        $title = addslashes(Get::req('name', DOTY_MIXED, ''));
        $description = addslashes(Get::req('description', DOTY_MIXED, ''));
        $query = "UPDATE " . $GLOBALS['prefix_lms'] . "_certificate_meta" . " SET title = '" . $title . "'," . " description = '" . $description . "'" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        if ($result) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=ok');
        } else {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=err_mod_info');
        }
    } else {
        list($title, $description) = sql_fetch_row(sql_query("SELECT title, description" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta" . " WHERE idMetaCertificate = '" . $id_meta . "'"));
        $out->add(getTitleArea($lang->def('_MOD'), 'certificate') . '<div class="std_block">' . $form->openForm('del_certificate', 'index.php?modname=meta_certificate&amp;op=modassignmetacertificate') . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->openElementSpace() . $form->getTextfield($lang->def('_NAME'), 'name', 'name', '255', $title) . $form->getSimpleTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('confirm', 'confirm', $lang->def('_SAVE')) . $form->getButton('undo_assign', 'undo_assign', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>');
    }
}
 case "getdialog":
     $idst = getLogUserId();
     $acl_man = Docebo::user()->getAclManager();
     $user_info = $acl_man->getUser($idst, false);
     $user_email = $user_info[ACL_INFO_EMAIL];
     $body = "";
     $body .= '<div class="line_field">' . Lang::t('_README_HELP', 'customer_help') . '</div>' . '<br />' . '<div class="line_field"><b>' . Lang::t('_USERNAME', 'standard') . ':</b> ' . $acl_man->relativeId(Docebo::user()->getUserId()) . '</div>';
     if (isset($GLOBALS['course_descriptor'])) {
         $body .= '<div class="line_field"><b>' . Lang::t('_COURSE_NAME', 'admin_course_management') . ':</b> ' . $GLOBALS['course_descriptor']->getValue('name') . '</div>';
     }
     $body .= '<div id="customer_help_error_message" class="align_center"></div>';
     $body .= Form::openForm('customer_help_form', 'ajax.server.php?mn=customer_help&plf=lms&op=send');
     $body .= Form::getTextfield(Lang::t('_TITLE', 'menu') . ':', 'help_req_subject', 'help_req_subject', 255, '');
     $body .= Form::getTextfield(Lang::t('_EMAIL', 'menu') . ':', 'help_req_email', 'help_req_email', 255, $user_email);
     $body .= Form::getTextfield(Lang::t('_PHONE', 'classroom') . ':', 'help_req_tel', 'help_req_tel', 255, '');
     $body .= Form::getSimpleTextarea(Lang::t('_TEXTOF', 'menu') . ':', 'help_req_text', 'help_req_text', '', false, false, 'textarea_full', 8, 40);
     $body .= Form::getHidden('help_req_resolution', 'help_req_resolution', '');
     $body .= Form::getHidden('help_req_flash_installed', 'help_req_flash_installed', '');
     $body .= Form::closeForm();
     $output = array('success' => true, 'body' => $body);
     $json = new Services_JSON();
     aout($json->encode($output));
     break;
 case "send":
     require_once _base_ . '/lib/lib.mailer.php';
     $help_email = Get::sett('customer_help_email', '');
     $help_pfx = Get::sett('customer_help_subj_pfx', '');
     $subject = !empty($help_pfx) ? "[" . $help_pfx . "] " : "";
     $subject .= chelpCheckField($_POST["help_req_subject"]);
     $idst = getLogUserId();
     $acl_man = Docebo::user()->getAclManager();
if (isset($id_fncrole)) {
    $content .= Form::getHidden('id_fncrole', 'id_fncrole', $id_fncrole);
}
//edit name and description in all languages (in a TabView widget)
$content .= '<div id="fncrole_langs_tab" class="yui-navset">';
$_tabview_titles = '<ul class="yui-nav">';
$_tabview_contents = '<div class="yui-content">';
//edit name and description in all languages
$_langs = Docebo::langManager()->getAllLanguages(true);
foreach ($_langs as $_lang_code => $_lang_data) {
    $_name = isset($fncrole_langs[$_lang_code]) ? $fncrole_langs[$_lang_code]['name'] : "";
    $_desc = isset($fncrole_langs[$_lang_code]) ? $fncrole_langs[$_lang_code]['description'] : "";
    $_tabview_titles .= '<li' . ($_lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $_lang_code . '"><em>' . $_lang_code . ($_name == '' && isset($id_group) ? ' (*)' : '') . '</em></a></li>';
    $_tabview_contents .= '<div id="langs_tab_' . $_lang_code . '">';
    $_tabview_contents .= Form::getTextfield(Lang::t('_NAME', 'standard'), 'name_' . $_lang_code, 'name[' . $_lang_code . ']', 255, $_name);
    $_tabview_contents .= Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'standard'), 'description_' . $_lang_code, 'description[' . $_lang_code . ']', $_desc);
    $_tabview_contents .= '</div>';
}
//end for
$_tabview_titles .= '</ul>';
$_tabview_contents .= '</div>';
$content .= $_tabview_titles . $_tabview_contents;
$content .= '</div>';
$content .= Form::closeForm();
//send output
if (isset($json)) {
    $params = array('success' => true, 'header' => $title, 'body' => $content);
    echo $json->encode($params);
} else {
    echo '<h2>' . $title . '</h2>';
    echo $content;
Example #7
0
<?php

echo Form::openForm('add_lang', 'ajax.adm_server.php?r=adm/lang/insertkey') . Form::getTextfield(Lang::t('_LANG_MODULE', 'admin_lang'), 'lang_module', 'lang_module', 255, '') . Form::getTextfield(Lang::t('_LANG_KEY', 'admin_lang'), 'lang_key', 'lang_key', 255, '');
?>
<div id="translation_tab" class="yui-navset">
	<ul class="yui-nav">
<?php 
$_langs = Docebo::langManager()->getAllLanguages(true);
foreach ($_langs as $_lang_code => $_lang_data) {
    echo '<li' . ($_lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $_lang_code . '"><em>' . $_lang_code . '</em></a>' . '</li>';
}
?>
	</ul>
	<div class="yui-content">
<?php 
foreach ($_langs as $_lang_code => $_lang_data) {
    echo '<div id="langs_tab_' . $_lang_code . '">' . Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'standard'), 'translation_' . $_lang_code, 'translation[' . $_lang_code . ']', '') . '</div>';
}
?>
	</div>
</div>
<?php 
echo Form::closeForm();
Example #8
0
echo getTitleArea(array('index.php?r=alms/label/show' => Lang::t('_LABELS', 'label'), Lang::t('_ADD', 'label')));
?>
<div class="std_block">

<?php 
echo Form::openForm('add_label_form', 'index.php?r=alms/label/add', false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getFilefield(Lang::t('_IMAGE', 'label'), 'label_image', 'label_image');
?>
<div id="label_edit" class="yui-navset">
	<ul class="yui-nav">
		<?php 
foreach ($all_languages as $lang_code) {
    echo '<li' . ($lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $lang_code . '"><em>' . $lang_code . '</em></a>' . '</li>';
}
?>
	</ul>
	<div class="yui-content">
		<?php 
foreach ($all_languages as $lang_code) {
    echo '<div id="langs_tab_' . $lang_code . '">' . Form::getTextfield(Lang::t('_TITLE', 'label'), $lang_code . '_title', $lang_code . '_title', 255) . Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'label'), $lang_code . '_description', $lang_code . '_description') . '</div>';
}
?>
	</div>
</div>
<script type="text/javascript">
	new YAHOO.widget.TabView("label_edit");
</script>
<?php 
echo Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('insert', 'insert', Lang::t('_INSERT', 'label')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'label')) . Form::closeButtonSpace() . Form::closeForm();
?>

</div>
Example #9
0
function edit_files($mode = "edit")
{
    require_once _base_ . '/lib/lib.upload.php';
    require_once _base_ . '/lib/lib.form.php';
    $form = new Form();
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('project', "lms");
    // Controllo che l'utente non cerchi di entrare in progetti a cui non e' iscritto.
    $id = $_GET["id"];
    $itemid = importVar("itemid");
    $myprj = user_projects(Docebo::user()->getIdSt());
    $view_perm = checkPerm('view', true);
    if ($view_perm && in_array($id, $myprj) && (is_owner(Docebo::user()->getIdSt(), $id) || is_admin(Docebo::user()->getIdSt(), $id))) {
        //area title
        $out->add(getTitleArea($lang->def("_PROJECT_MANAGER"), "project"));
        $out->add('<div class="std_block">');
        if ($mode == "edit") {
            $goto = "prjedititem";
        }
        if ($mode == "new") {
            $goto = "prjadditem";
        }
        if (isset($_POST["applychanges"])) {
            $ftitle = $_POST["ftitle"];
            $fver = $_POST["fver"];
            $fdesc = $_POST["fdesc"];
            if ($mode == "new") {
                $ok = 1;
                //save file
                sl_open_fileoperations();
                if (!isset($_FILES['attach']) || $_FILES['attach']['name'] == '') {
                    $savefile = '';
                } else {
                    $savefile = $_SESSION['idCourse'] . '_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['attach']['name'];
                    if (!file_exists(_FPATH_INTERNAL . $savefile)) {
                        if (!sl_upload($_FILES['attach']['tmp_name'], _FPATH_INTERNAL . $savefile)) {
                            $savefile = '';
                            $ok = 0;
                        }
                    } else {
                        $savefile = '';
                        $ok = 0;
                    }
                }
                sl_close_fileoperations();
                if ($ok && $savefile != "") {
                    $query = sql_query("INSERT INTO " . $GLOBALS["prefix_lms"] . "_prj_files (pid,fname,ftitle,fver,fdesc) VALUES('{$id}','" . (get_magic_quotes_gpc() ? $savefile : mysql_escape_string($savefile)) . "','{$ftitle}','{$fver}','{$fdesc}');");
                }
            }
            if ($mode == "edit") {
                $query = sql_query("UPDATE " . $GLOBALS["prefix_lms"] . "_prj_files SET ftitle='{$ftitle}',fver='{$fver}',fdesc='{$fdesc}' WHERE id='{$itemid}' LIMIT 1;");
            }
            Util::jump_to(" index.php?modname=project&op=showprj&id={$id}");
        }
        $url = "index.php?modname=project&amp;op=showprj&amp;id=" . $id;
        $out->add(getBackUi($url, $lang->def('_BACK')));
        if ($mode == "edit") {
            $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_files WHERE pid='{$id}' AND id='{$itemid}';");
            if ($query && mysql_num_rows($query) > 0) {
                $row = mysql_fetch_array($query);
            }
            $label = $lang->def("_SAVE");
        } else {
            if ($mode == "new") {
                $row = array();
                $label = $lang->def("_SAVE");
            }
        }
        $ftitle = isset($row["ftitle"]) ? $row["ftitle"] : '';
        $fver = isset($row["fver"]) ? $row["fver"] : '';
        $fdesc = isset($row["fdesc"]) ? $row["fdesc"] : '';
        $url = "index.php?modname=project&amp;op={$goto}&amp;type=file&amp;id={$id}&amp;itemid=" . $itemid;
        $out->add($form->openForm("form_name", $url, "", "", "multipart/form-data"));
        $out->add($form->openElementSpace());
        if ($mode == "new") {
            $out->add($form->getFilefield($lang->def("_FILE"), "attach", "attach"));
        }
        $out->add($form->getTextfield($lang->def("_TITLE"), "ftitle", "ftitle", 255, $ftitle));
        $out->add($form->getTextfield($lang->def("_VERSION"), "fver", "fver", 255, $fver));
        $out->add($form->getSimpleTextarea($lang->def("_DESCRIPTION"), "fdesc", "fdesc", $fdesc));
        $out->add($form->getHidden("applychanges", "applychanges", 1));
        $out->add($form->closeElementSpace());
        $out->add($form->openButtonSpace());
        $out->add($form->getButton('save', 'save', $label));
        $out->add($form->getButton('undo', 'undo', $lang->def('_UNDO')));
        $out->add($form->closeButtonSpace());
        $out->add($form->closeForm());
        $out->add('<br /></div>');
        return 0;
        $out->add("<form method=\"post\" action=\"index.php?modname=project&amp;op={$goto}&amp;type=file&amp;id={$id}&amp;itemid={$itemid}\" enctype=\"multipart/form-data\">\n" . '<input type="hidden" id="authentic_request_prj" name="authentic_request" value="' . Util::getSignature() . '" />');
        $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_files WHERE pid='{$id}' AND id='{$itemid}';");
        if ($query && mysql_num_rows($query) > 0 || $mode == "new") {
            if ($mode == "edit") {
                $row = mysql_fetch_array($query);
            }
            if ($mode == "new") {
                $row = array();
            }
            $out->add("<table><tr>\n");
            if ($mode != "edit") {
                $out->add($lang->def("_FILE") . ":<br /><input type=\"file\" id=\"attach\" name=\"attach\" size=\"50\" /><br /><br />\n");
            }
            $out->add($lang->def("_TITLE") . ": <input type=\"text\" size=\"40\" id=\"ttitle\" name=\"ftitle\" value=\"" . (isset($row["ftitle"]) ? $row["ftitle"] : '') . "\" /></td>\n");
            $out->add("</tr><tr><td>" . $lang->def("_VERSION") . "\n ");
            $out->add("<input type=\"text\" size=\"35\" id=\"fver\" name=\"fver\" value=\"" . (isset($row["fver"]) ? $row["fver"] : '') . "\" /></td>\n");
            $out->add("</tr><tr><td colspan=\"2\"><textarea rows=\"6\" cols=\"30\" id=\"fdesc\" name=\"fdesc\">\n");
            $out->add(isset($row["fdesc"]) ? $row["fdesc"] : '');
            $out->add("</textarea>\n");
            $out->add("</td></tr></table><br />\n");
        }
        if ($mode == "edit") {
            $label = $lang->def("_SAVE");
        }
        if ($mode == "new") {
            $label = $lang->def("_SAVE");
        }
        $out->add("<input type=\"hidden\" id=\"applychanges\" name=\"applychanges\" value=\"1\" />\n");
        $out->add("<input class=\"button\" type=\"submit\" value=\"" . $label . "\" />\n");
        $out->add("</form><br />\n");
        //$out->add("<div align=\"center\"><b>[ <a href=\"index.php?modname=project&amp;op=showprj&amp;id=$id\">".$lang->def("_BACK")."</a> ]</b></div>\n");
        $url = "index.php?modname=project&amp;op=showprj&amp;id=" . $id;
        $out->add(getBackUi($url, $lang->def('_BACK')));
        $out->add('<br /></div>');
    } else {
        $out->add("You can't access");
    }
}
Example #10
0
    $_form_id = 'mod_policy_form';
    $_form_action = 'ajax.adm_server.php?r=adm/privacypolicy/mod_action';
} else {
    $_form_id = 'add_policy_form';
    $_form_action = 'ajax.adm_server.php?r=adm/privacypolicy/add_action';
}
echo Form::openForm($_form_id, $_form_action);
echo Form::getTextfield(Lang::t('_NAME', 'standard'), 'policy_name', 'name', 255, isset($id_policy) && isset($name) ? $name : "");
//if we are editing an existent policy, print its id
if (isset($id_policy)) {
    echo Form::getHidden('id_policy', 'id_policy', $id_policy);
}
//edit name and description in all languages (in a TabView widget)
echo '<div id="policy_langs_tab" class="yui-navset">';
$_tabview_titles = '<ul class="yui-nav">';
$_tabview_contents = '<div class="yui-content">';
//edit policy content in all languages
$_langs = Docebo::langManager()->getAllLanguages(true);
foreach ($_langs as $_lang_code => $_lang_data) {
    $_translation = isset($id_policy) && isset($translations[$_lang_code]) ? $translations[$_lang_code] : "";
    $_tabview_titles .= '<li' . ($_lang_code == Lang::get() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $_lang_code . '"><em>' . $_lang_code . ($_translation == '' && isset($id_policy) ? ' (*)' : '') . '</em></a></li>';
    $_tabview_contents .= '<div id="langs_tab_' . $_lang_code . '">';
    $_tabview_contents .= Form::getSimpleTextarea(Lang::t('_CONTENT', 'standard'), 'translation_' . $_lang_code, 'translation[' . $_lang_code . ']', $_translation);
    $_tabview_contents .= '</div>';
}
//end for
$_tabview_titles .= '</ul>';
$_tabview_contents .= '</div>';
echo $_tabview_titles . $_tabview_contents;
echo '</div>';
echo Form::closeForm();
 protected function _getEditMask($idst = false)
 {
     require_once _base_ . '/lib/lib.form.php';
     $group_types = $this->model->getGroupTypes(true);
     $acl = Docebo::user()->getAclManager();
     if ($idst > 0) {
         $group_info = $this->model->getGroupInfo($idst);
         $action = "ajax.adm_server.php?r=adm/groupmanagement/moddata&id=" . $idst;
     } else {
         $action = "ajax.adm_server.php?r=adm/groupmanagement/creategroup";
         $group_info = array('groupid' => '', 'description' => '', 'type' => 'free');
     }
     $body = "";
     $body .= Form::openForm($idst > 0 ? 'modify_group_' . $idst : 'create_group', $action);
     if ($idst > 0) {
         $body .= Form::getHidden('id', 'id', $idst);
     }
     $body .= Form::getTextfield(Lang::t('_NAME', 'standard'), 'groupid', 'groupid', 255, $group_info['groupid'] != "" ? $acl->relativeId($group_info['groupid']) : "");
     $body .= Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'standard'), 'description', 'description', $group_info['description']);
     //$body .= Form::getDropdown(Lang::t('_DIRECTORY_GROUPTYPE', 'admin_directory'), 'type', 'type', $group_types, $group_info['type']);
     $body .= Form::closeForm();
     return $body;
 }
Example #12
0
 function addeditFaq($cat_id, $id = 0)
 {
     $res = "";
     require_once _base_ . "/lib/lib.form.php";
     $form = new Form();
     $form_code = "";
     $um =& UrlManager::getInstance();
     $url = $um->getUrl("op=savefaq&catid=" . $cat_id);
     if ($id == 0) {
         $form_code = $form->openForm("main_form", $url);
         $submit_lbl = $this->lang->def("_INSERT");
         $title = "";
         $question = "";
         $keyword = "";
         $answer = "";
     } else {
         if ($id > 0) {
             $form_code = $form->openForm("main_form", $url);
             $submit_lbl = $this->lang->def("_SAVE");
             $info = $this->wikiManager->getFaqInfo($id);
             $title = $info["title"];
             $question = $info["question"];
             $keyword = $info["keyword"];
             $answer = $info["answer"];
         }
     }
     $res .= $form_code;
     $res .= $form->openElementSpace();
     $res .= $form->getTextfield($this->lang->def("_TITLE"), "title", "title", 255, $title);
     $res .= $form->getTextfield($this->lang->def("_QUESTION"), "question", "question", 255, $question);
     $res .= $form->getSimpleTextarea($this->lang->def("_KEYWORDS"), "keyword", "keyword", $keyword);
     $res .= $form->getTextarea($this->lang->def("_ANSWER"), "answer", "answer", $answer);
     $res .= $form->getHidden("cat_id", "cat_id", $cat_id);
     $res .= $form->getHidden("id", "id", $id);
     $res .= $form->closeElementSpace();
     $res .= $form->openButtonSpace();
     $res .= $form->getButton('save', 'save', $submit_lbl);
     $res .= $form->getButton('undo', 'undo', $this->lang->def('_UNDO'));
     $res .= $form->closeButtonSpace();
     $res .= $form->closeForm();
     return $res;
 }
 function waitinguser()
 {
     if (!$this->permissions['moderate']) {
         die("You can't access");
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _adm_ . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.user_profile.php';
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $man_course = new Man_Course();
     $course_info = $man_course->getCourseInfo($id_course);
     $is_classroom = $course_info['course_type'] == 'classroom';
     $edition_id = Get::req('id_edition', DOTY_INT, 0);
     $ed_url_param = '&id_edition=' . $edition_id;
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
     $acl_man =& Docebo::user()->getAclManager();
     $levels = CourseLevel::getLevels();
     $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
     $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
     $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
     $page_title = array('index.php?r=' . $this->link_course . '/show' => Lang::t('_COURSES', 'course'), Lang::t('_USERWAITING', 'course') . ': ' . $course_info['name']);
     $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?r=' . $this->link . '/approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
     $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
     $type_h = array();
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = '';
     if ($is_classroom) {
         $type_h[] = '';
     }
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $content_h = array();
     $content_h[] = $lang->def('_USERNAME');
     $content_h[] = $lang->def('_FULLNAME');
     $content_h[] = $lang->def('_LEVEL');
     if ($is_classroom) {
         $content_h[] = $lang->def('_CLASSROOM');
     }
     $content_h[] = $lang->def('_SUBSCRIBED_BY');
     $content_h[] = $lang->def('_STATUS');
     $content_h[] = $lang->def('_APPROVE');
     $content_h[] = $lang->def('_DENY');
     $content_h[] = $lang->def('_WAIT');
     $tb->addHead($content_h, $type_h);
     if (is_array($waiting_users['users_info'])) {
         reset($waiting_users['users_info']);
         while (list($id_user, $info) = each($waiting_users['users_info'])) {
             $id_sub_by = $info['subscribed_by'];
             $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
             $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/menu_open.png"></a> ' : '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/menu_closed.png"></a> ';
             $is_overbooking = FALSE;
             if ($is_classroom) {
                 $is_overbooking = $info['overbooking'];
             } else {
                 $is_overbooking = FALSE;
                 //$info['status'] == _CUS_OVERBOOKING
             }
             $content = array();
             $content[] = $more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]);
             $content[] = $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME];
             $content[] = $levels[$info['level']];
             if ($is_classroom) {
                 $content[] = ($info['code'] != '' ? '[' . $info['code'] . '] ' : '') . $info['name'];
             }
             $content[] = $subscribed . ' [' . $users_name[$id_sub_by][ACL_INFO_EMAIL] . ']';
             $content[] = $is_overbooking ? $lang->def('_OVERBOOKING') : $arr_status[$info['status']];
             if ($is_overbooking) {
                 $content[] = '';
                 $content[] = '';
                 $content[] = '';
             } else {
                 $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
             }
             $tb->addBody($content);
             if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                 $field = new FieldList();
                 $info = $field->playFieldsForUser($id_user, false, true);
                 $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
             }
         }
     }
     $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }
Example #14
0
 function modlink()
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('link');
     require_once _base_ . '/lib/lib.form.php';
     $back_url = urldecode($_GET['back_url']);
     $back_coded = htmlentities(urlencode($back_url));
     list($idCategory, $title, $link_a, $keyword, $description) = sql_fetch_row(sql_query("\r\n\tSELECT idCategory, title, link_address, keyword, description \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link \r\n\tWHERE idLink = '" . (int) $_GET['idLink'] . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_LINK'), 'link') . '<div class="std_block">' . getBackUi('index.php?modname=link&op=modlinkgui&idCategory=' . $idCategory . '&back_url=' . $back_coded, $lang->def('_BACK')) . Form::openForm('faqform', 'index.php?modname=link&amp;op=uplink') . Form::openElementSpace() . Form::getHidden('idLink', 'idLink', $_GET['idLink']) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $title) . Form::getTextfield($lang->def('_LINK_ADDRESS'), 'link_a', 'link_a', 255, $link_a) . Form::getSimpleTextarea($lang->def('_KEYWORD'), 'keyword', 'keyword', $keyword) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('modlink', 'modlink', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Example #15
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');
}
Example #16
0
function waitinguser()
{
    checkPerm('moderate', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    $id_course = importVar('id_course', true, 0);
    $man_course = new Man_Course();
    $course_info = $man_course->getCourseInfo($id_course);
    $edition_id = getCourseEditionId();
    $ed_url_param = getEditionUrlParameter($edition_id);
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $levels = CourseLevel::getLevels();
    $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
    $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
    $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
    $page_title = array('index.php?modname=course&amp;op=course_list' => $lang->def('_COURSE', 'course', 'lms'), $course_info['name'], $lang->def('_USERWAITING', 'course', 'lms'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?modname=subscribe&amp;op=approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
    $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
    $type_h = array('', '', '', '', '', 'image', 'image', 'image');
    $content_h = array($lang->def('_USERNAME'), $lang->def('_FULLNAME'), $lang->def('_LEVEL'), $lang->def('_SUBSCRIBED_BY'), $lang->def('_STATUS'), $lang->def('_APPROVE'), $lang->def('_DENY'), $lang->def('_WAIT'));
    $tb->addHead($content_h, $type_h);
    if (is_array($waiting_users['users_info'])) {
        reset($waiting_users['users_info']);
        while (list($id_user, $info) = each($waiting_users['users_info'])) {
            $id_sub_by = $info['subscribed_by'];
            $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
            $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?modname=subscribe&amp;op=waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=subscribe&amp;op=waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
            $content = array($more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]), $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME], $levels[$info['level']], $subscribed . ' [' . $users_name[$id_user][ACL_INFO_EMAIL] . ']');
            $content[] = $arr_status[$info['status']];
            $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $tb->addBody($content);
            if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                $field = new FieldList();
                $info = $field->playFieldsForUser($id_user, false, true);
                $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
            }
        }
    }
    $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Example #17
0
 /**
  * display the field for interaction
  *
  * @param 	int		$id_user	if alredy exists a entry for the user load as default value
  * @param 	bool	$freeze	if true, disable the user interaction
  *
  * @return string 	of field xhtml code
  *
  * @access public
  */
 function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL)
 {
     require_once _base_ . '/lib/lib.form.php';
     if (isset($_POST['field_' . $this->getFieldType()]) && isset($_POST['field_' . $this->getFieldType()][$this->id_common])) {
         $user_entry = $_POST['field_' . $this->getFieldType()][$this->id_common];
     } else {
         list($user_entry) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT user_entry\r\n\t\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\t\tWHERE id_user = '******' AND\r\n\t\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\t\tid_common_son = '0'"));
     }
     $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE lang_code = '" . getLanguage() . "' AND id_common = '" . (int) $this->id_common . "' AND type_field = '" . $this->getFieldType() . "'");
     list($translation) = sql_fetch_row($re_field);
     if ($value !== NULL) {
         $user_entry = "" . $value;
     }
     if ($freeze) {
         return Form::getLineBox($translation . ' : ', $user_entry);
     }
     return Form::getSimpleTextarea($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', $user_entry);
 }
Example #18
0
function modGroupCode()
{
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('code');
    $id_code_group = Get::req('id_code_group', DOTY_INT, '0');
    $code_manager = new CodeManager();
    cout(getTitleArea(array('index.php?modname=code&amp;op=list' => $lang->def('_CODE'), $lang->def('_MOD'))) . '<div class="std_block">');
    if (Get::req('confirm', DOTY_MIXED, '')) {
        $title = addslashes(Get::req('title', DOTY_MIXED, ''));
        $description = addslashes(Get::req('description', DOTY_MIXED, ''));
        if ($code_manager->updateCodeGroup($id_code_group, $title, $description)) {
            Util::jump_to('index.php?modname=code&amp;op=list&result=ok');
        }
        Util::jump_to('index.php?modname=code&amp;op=list&result=err');
    }
    $group_code_info = $code_manager->getCodeGroupInfo($id_code_group);
    cout(Form::openForm('mod_group_code_form', 'index.php?modname=code&amp;op=mod_group_code') . Form::openElementSpace() . Form::getTextField($lang->def('_TITLE'), 'title', 'title', '255', $group_code_info['title']) . Form::getSimpleTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $group_code_info['description']) . Form::getHidden('id_code_group', 'id_code_group', $id_code_group) . Form::closeElementSPace() . Form::openButtonSpace() . Form::getButton('confirm', 'confirm', $lang->def('_MOD')) . Form::getButton('undo_group', 'undo_group', $lang->def('_UNDO')) . Form::closeButtonSpace() . '</div>');
}
Example #19
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>');
}
Example #20
0
 function modfaq()
 {
     checkPerm('view', false, 'storage');
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('faq');
     $back_url = urldecode($_GET['back_url']);
     $back_coded = htmlentities(urlencode($back_url));
     list($idCategory, $question, $title, $keyword, $answer) = sql_fetch_row(sql_query("\r\n\tSELECT idCategory, question, title, keyword, answer \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\tWHERE idFaq = '" . (int) $_GET['idFaq'] . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_FAQ'), 'faq') . '<div class="std_block">' . getBackUi('index.php?modname=faq&op=modfaqgui&idCategory=' . $idCategory . '&back_url=' . $back_coded, $lang->def('_BACK')) . Form::openForm('faqform', 'index.php?modname=faq&amp;op=upfaq') . Form::openElementSpace() . Form::getHidden('idFaq', 'idFaq', $_GET['idFaq']) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getTextfield($lang->def('_QUESTION'), 'question', 'question', 255, $question) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $title) . Form::getSimpleTextarea($lang->def('_KEYWORD'), 'keyword', 'keyword', $keyword) . Form::getTextarea($lang->def('_ANSWER'), 'answer', 'answer', $answer) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('addsinglefaq', 'addsinglefaq', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }