本文整理汇总了PHP中Docebo::langManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Docebo::langManager方法的具体用法?PHP Docebo::langManager怎么用?PHP Docebo::langManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Docebo
的用法示例。
在下文中一共展示了Docebo::langManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: organization_categorize_save
function organization_categorize_save(&$treeView, $idItem)
{
require_once _lms_ . '/lib/lib.kbres.php';
$folder = $treeView->tdb->getFolderById($idItem);
$data = $folder->otherValues;
$res_id = Get::req('res_id', DOTY_INT, 0);
$name = Get::req('r_name', DOTY_STRING, "");
$original_name = Get::req('original_name', DOTY_STRING, "");
$desc = Get::req('r_desc', DOTY_STRING, "");
$r_item_id = Get::req('r_item_id', DOTY_INT, 0);
$type = Get::req('r_type', DOTY_STRING, "");
$env = Get::req('r_env', DOTY_STRING, "");
$env_parent_id = Get::req('r_env_parent_id', DOTY_INT, 0);
$param = '';
//Get::req('', DOTY_STRING, "");
$alt_desc = '';
$lang_id = Get::req('r_lang', DOTY_INT, "");
$lang_arr = Docebo::langManager()->getAllLangCode();
$lang = $lang_arr[$lang_id];
$force_visible = Get::req('force_visible', DOTY_INT, 0);
$is_mobile = Get::req('is_mobile', DOTY_INT, 0);
$folders = Get::req('h_selected_folders', DOTY_STRING, "");
$json_tags = Util::strip_slashes(Get::req('tag_list', DOTY_STRING, "[]"));
$kbres = new KbRes();
$res_id = $kbres->saveResource($res_id, $name, $original_name, $desc, $r_item_id, $type, $env, $env_parent_id, $param, $alt_desc, $lang, $force_visible, $is_mobile);
$json_tags = str_replace("[", "", $json_tags);
$json_tags = str_replace("]", "", $json_tags);
$json_tags = str_replace('"', "", $json_tags);
$json_tags = str_replace("\\", "", $json_tags);
$tags_arr = explode(",", $json_tags);
if ($res_id > 0) {
$kbres->setResourceTags($res_id, $tags_arr);
$kbres->assignToFolders($res_id, explode(',', $folders));
}
}
示例2: getLmsLangFlags
function getLmsLangFlags()
{
$lang =& DoceboLanguage::createInstance('blind_navigation');
$blind_link = "<li><a href=\"#lang_box\">" . $lang->def("_LANG_SELECT") . "</a></li>";
$GLOBALS["page"]->add($blind_link, "blind_navigation");
$all_lang = Docebo::langManager()->getAllLangCode();
if (!is_array($all_lang)) {
return '';
}
$res = '<ul id="lang_box">';
foreach ($all_lang as $k => $lang_code) {
$res .= '<a href="index.php?sop=changelang&new_lang=' . $lang_code . '" title="' . $lang_code . '">' . '<img src="' . getPathImage('fw') . 'language/' . $lang_code . '.png" alt="' . $lang_code . '" /></a>';
}
$res .= '</ul>';
return $res;
}
示例3: getInitData
public function getInitData($js = true)
{
//produces languages' list variable
$temp1 = array('{ id: "standard", value: "[ ' . addslashes(Lang::t('_DEFAULT_LANGUAGE')) . ' ]" }');
foreach (Docebo::langManager()->getAllLanguages() as $lang) {
$temp1[] = '{ id: "' . $lang[0] . '", value: "' . addslashes($lang[0] . ' (' . $lang[1] . ')') . '" }';
}
//produce admin levels list
$temp2 = array();
$arr_admin_levels = $this->acl_man->getAdminLevels();
foreach ($arr_admin_levels as $lev => $idst) {
$temp2[] = '{ id: "' . $lev . '", value: "' . addslashes(Lang::t('_DIRECTORY_' . $lev, 'admin_directory')) . '" }';
}
if (!$js) {
$output = array('languages' => $temp1, 'levels' => $temp2);
} else {
$js_langs = "[" . implode(",", $temp1) . "]";
$js_levels = "[" . implode(",", $temp2) . "]";
$output = array('languages' => $js_langs, 'levels' => $js_levels);
}
return $output;
}
示例4: homerepo_itemproperties
function homerepo_itemproperties(&$treeView, &$arrayData, $idItem)
{
//function loadFields( $arrayData, &$lo, $idLO ) {
$lang =& DoceboLanguage::createInstance('homerepo', 'lms');
$langClassification =& DoceboLanguage::createInstance('classification', 'lms');
$GLOBALS['page']->add('<form id="manHomerepo" method="post"' . ' action="index.php?' . $_SERVER['QUERY_STRING'] . '"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_hrs" name="authentic_request" value="' . Util::getSignature() . '" />');
$GLOBALS['page']->add('<div class="std_block">');
$GLOBALS['page']->add($treeView->printState());
global $defaultLanguage;
//including language
//includeLang("classification");
//finding category
$reCategory = sql_query("\r\n\tSELECT idCategory, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursecategory\r\n\tORDER BY title");
//searching languages
/*$langl = dir('menu/language/');
while($ele = $langl->read())
if(ereg("lang-",$ele)) {
$langArray[] = ereg_replace("lang-","",ereg_replace(".php","",$ele));
}
closedir($langl->handle);
sort($langArray);*/
$langArray = Docebo::langManager()->getAllLangCode();
if (!isset($_POST['idItem'])) {
if ($idItem !== NULL) {
$folder = $treeView->tdb->getFolderById($idItem);
$GLOBALS['page']->add('<input type="hidden" name="idItem" id="idItem" value="' . $idItem . '" />');
$title = $folder->otherValues[REPOFIELDTITLE];
$arrayData['version'] = $folder->otherValues[REPOFIELDVERSION];
$arrayData['difficult'] = $folder->otherValues[REPOFIELDDIFFICULT];
$arrayData['language'] = $folder->otherValues[REPOFIELDLANGUAGE];
$arrayData['resource'] = $folder->otherValues[REPOFIELDRESOURCE];
$arrayData['objective'] = $folder->otherValues[REPOFIELDOBJECTIVE];
}
} else {
$GLOBALS['page']->add('<input type="hidden" name="idItem" id="idItem" value="' . $idItem . '" />');
$title = $_POST['title'];
}
// ==========================================================
$GLOBALS['page']->add('<input type="hidden" name="title" id="title" value="' . $title . '" />');
$GLOBALS['page']->add('<div class="ObjectForm">');
$GLOBALS['page']->add('<span class="mainTitle">' . $langClassification->def('_CATEGORIZATION') . ' ' . $title . '</span><br /><br />');
$GLOBALS['page']->add('</div>');
//-------------------------------------------------
/* .'<div class="title">'._CATEGORY.'</div>'
.'<div class="content">'
.'<select name="idCategory">';
if( isset($arrayData['idCategory']) )
$selectedIdCat = $arrayData['idCategory'];
else
$selectedIdCat = "";
while(list($idCat, $catTitle) = sql_fetch_row($reCategory)) {
if( $selectedIdCat == $idCat )
echo '<option value="'.$idCat.'" selected >'.$catTitle.'</option>';
else
echo '<option value="'.$idCat.'">'.$catTitle.'</option>';
}
echo '</select> ( '.sql_num_rows($reCategory).' '._DISP.')'
.'</div>'*/
//-------------------------------------------------
$GLOBALS['page']->add('<div class="title">' . $langClassification->def('_VERSION') . '</div>' . '<div class="content">');
if (isset($arrayData['version'])) {
$GLOBALS['page']->add('<input type="text" name="version" maxlength="8" size="10" value="' . $arrayData['version'] . '" />');
} else {
$GLOBALS['page']->add('<input type="text" name="version" maxlength="8" size="10" value="1.0" />');
}
$GLOBALS['page']->add('</div>' . '<div class="title">' . $langClassification->def('_DIFFICULTY') . '</div>' . '<div class="content">' . '<select name="difficult">');
if (isset($arrayData['difficult'])) {
$selDiff = $arrayData['difficult'];
switch ($selDiff) {
case '_DIFFICULT_VERYEASY':
$selDiff = "1";
break;
case '_DIFFICULT_EASY':
$selDiff = "2";
break;
case '_DIFFICULT_MEDIUM':
$selDiff = "3";
break;
case '_DIFFICULT_DIFFICULT':
$selDiff = "4";
break;
case '_DIFFICULT_VERYDIFFICULT':
$selDiff = "5";
break;
}
} else {
$selDiff = "";
}
$GLOBALS['page']->add('<option value="1" ' . ($selDiff == "1" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_VERYEASY') . '</option>' . '<option value="2" ' . ($selDiff == "2" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_EASY') . '</option>' . '<option value="3" ' . ($selDiff == "3" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_MEDIUM') . '</option>' . '<option value="4" ' . ($selDiff == "4" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_DIFFICULT') . '</option>' . '<option value="5" ' . ($selDiff == "5" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_VERYDIFFICULT') . '</option>' . '</select>' . '</div>');
//-------------------------------------------------
/*.'<div class="title">'._DESCRIPTION.'</div>'
.'<div class="content">'
.'<div id="breakfloat">'
.'<textarea id="description" name="description" rows="10" cols="75"></textarea></div>'
.'</div>'*/
//-------------------------------------------------
$GLOBALS['page']->add('<div class="title">' . $langClassification->def('_LANGUAGE') . '</div>' . '<div class="content">' . '<select name="language">');
if (isset($arrayData['language'])) {
//.........这里部分代码省略.........
示例5: getPolicyTranslations
public function getPolicyTranslations($id_policy)
{
$output = false;
$query = "SELECT * FROM %adm_privacypolicy_lang WHERE id_policy=" . (int) $id_policy;
$res = $this->db->query($query);
if ($res && $this->db->num_rows($res) > 0) {
//initialize output
$lang_codes = Docebo::langManager()->getAllLangCode();
$output = array();
foreach ($lang_codes as $lang_code) {
$output[$lang_code] = "";
}
//read values from DB and prepare output
while ($obj = $this->db->fetch_obj($res)) {
if (isset($output[$obj->lang_code])) {
$output[$obj->lang_code] = $obj->translation;
}
}
}
return $output;
}
示例6: _step0
function _step0()
{
// ---- name -----
$out = $this->form->getTextfield($this->lang->def('_NAME'), $this->_get_base_name() . '_name', $this->_get_base_name() . '[name]', 255, $this->post_params['name']);
// ---- description -----
$out .= $this->form->getSimpleTextarea($this->lang->def('_DESCRIPTION'), $this->_get_base_name() . '_description', $this->_get_base_name() . '[description]', $this->post_params['description']);
// ---- access type read/write -----
$out .= $this->form->getRadioSet($this->lang->def('_ACCESSTYPE'), $this->_get_base_name() . '_readwrite', $this->_get_base_name() . '[readwrite]', array($this->lang->def('_READ') => '1', $this->lang->def('_WRITE') => '2', $this->lang->def('_READWRITE') => '3'), $this->post_params['readwrite']);
// ---- remove or not folders ----
$out .= $this->form->getRadioSet($this->lang->def('_CANCELED_FOLDER'), $this->_get_base_name() . '_canceled', $this->_get_base_name() . '[canceled]', array($this->lang->def('_DONTDELETE') => '1', $this->lang->def('_DEL') => '2'), $this->post_params['canceled']);
// ---- default lang ----
$languages = Docebo::langManager()->getAllLangCode();
$lang_key = array();
for ($index = 0; $index < count($languages); $index++) {
$lang_key[$languages[$index]] = $languages[$index];
}
$out .= $this->form->getDropdown($this->lang->def('_LANGUAGE'), $this->_get_base_name() . 'default_lang', $this->_get_base_name() . '[default_lang]', $lang_key, $this->post_params['default_lang']);
return $out;
}
示例7: mod
public function mod()
{
if (!$this->permissions['mod']) {
$this->render('invalid', array('message' => $this->_getMessage('no permission'), 'back_url' => 'index.php?r=alms/label/show'));
return;
}
$id_common_label = Get::req('id_common_label', DOTY_INT, 0);
if (isset($_POST['undo'])) {
Util::jump_to('index.php?r=alms/label/show');
}
$all_languages = Docebo::langManager()->getAllLangCode();
$res = true;
if (isset($_POST['update'])) {
require_once _base_ . '/lib/lib.upload.php';
$path = '/appLms/label/';
if (isset($_POST['del_label_image'])) {
$file_name = $this->model->getLabelFile($id_common_label);
if ($file_name !== '' && sl_file_exists($path . $file_name)) {
sl_open_fileoperations();
sl_unlink($path . $file_name);
sl_close_fileoperations();
}
$file_name = '';
} else {
$file_name = $this->model->getLabelFile($id_common_label);
}
if ($_FILES['label_image']['error'] == 0) {
$extension = end(explode('.', $_FILES['label_image']['name']));
$file_name = 'label_image_' . $id_common_label . '.' . $extension;
sl_open_fileoperations();
$file_name_del = $this->model->getLabelFile($id_common_label);
if ($file_name_del !== '' && sl_file_exists($path . $file_name_del)) {
sl_unlink($path . $file_name_del);
}
sl_upload($_FILES['label_image']['tmp_name'], $path . $file_name);
sl_close_fileoperations();
}
foreach ($all_languages as $lang_code) {
$title = Get::req($lang_code . '_title', DOTY_MIXED, '');
$description = Get::req($lang_code . '_description', DOTY_MIXED, '');
$tmp_res = $this->model->updateLabel($id_common_label, $lang_code, $title, $description, $file_name);
if (!$tmp_res) {
$res = false;
}
}
if ($res) {
Util::jump_to('index.php?r=alms/label/show&res=_ok_mod');
}
Util::jump_to('index.php?r=alms/label/show&err=_err_mod');
}
$label_info = $this->model->getLabelInfo($id_common_label);
$params = array('model' => $this->model, 'all_languages' => $all_languages, 'label_info' => $label_info, 'id_common_label' => $id_common_label);
$this->render('mod', $params);
}
示例8: upCourse
public function upCourse()
{
require_once _base_ . '/lib/lib.upload.php';
require_once _base_ . '/lib/lib.multimedia.php';
require_once _lms_ . '/lib/lib.course.php';
require_once _lms_ . '/lib/lib.manmenu.php';
$array_lang = Docebo::langManager()->getAllLangCode();
$array_lang[] = 'none';
$acl_man =& Docebo::user()->getAclManager();
$id_course = Get::req('id_course', DOTY_INT, 0);
require_once _lms_ . '/admin/models/LabelAlms.php';
$label_model = new LabelAlms();
$label = Get::req('label', DOTY_INT, 0);
$label_model->associateLabelToCourse($label, $id_course);
// calc quota limit
$quota = $_POST['course_quota'];
if (isset($_POST['inherit_quota'])) {
$quota = Get::sett('course_quota');
$_POST['course_quota'] = COURSE_QUOTA_INHERIT;
}
$quota = $quota * 1024 * 1024;
$course_man = new DoceboCourse($id_course);
$used = $course_man->getUsedSpace();
if ($_POST['course_name'] == '') {
$_POST['course_name'] = Lang::t('_NO_NAME', 'course', 'lms');
}
// restriction on course status ------------------------------------------
$user_status = 0;
if (isset($_POST['user_status'])) {
while (list($status) = each($_POST['user_status'])) {
$user_status |= 1 << $status;
}
}
// level that will be showed in the course --------------------------------
$show_level = 0;
if (isset($_POST['course_show_level'])) {
while (list($lv) = each($_POST['course_show_level'])) {
$show_level |= 1 << $lv;
}
}
// save the file uploaded -------------------------------------------------
$error = false;
$quota_exceeded = false;
$path = Get::sett('pathcourse');
$path = '/appLms/' . Get::sett('pathcourse') . (substr($path, -1) != '/' && substr($path, -1) != '\\' ? '/' : '');
$old_file_size = 0;
if (is_array($_FILES) && !empty($_FILES) || is_array($_POST["file_to_del"])) {
sl_open_fileoperations();
}
// load user material ---------------------------------------------------------------------------
$arr_file = $this->manageCourseFile('course_user_material', $_POST["old_course_user_material"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_user_material']));
$error |= $arr_file['error'];
$quota_exceeded |= $arr_file['quota_exceeded'];
$file_material = $arr_file['filename'];
$used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
$old_file_size += $arr_file['old_size'];
// course otheruser material -------------------------------------------------------------------
$arr_file = $this->manageCourseFile('course_otheruser_material', $_POST["old_course_otheruser_material"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_otheruser_material']));
$error |= $arr_file['error'];
$quota_exceeded |= $arr_file['quota_exceeded'];
$file_othermaterial = $arr_file['filename'];
$used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
$old_file_size += $arr_file['old_size'];
// course demo-----------------------------------------------------------------------------------
$arr_file = $this->manageCourseFile('course_demo', $_POST["old_course_demo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_demo']));
$error |= $arr_file['error'];
$quota_exceeded |= $arr_file['quota_exceeded'];
$file_demo = $arr_file['filename'];
$used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
$old_file_size += $arr_file['old_size'];
// course sponsor---------------------------------------------------------------------------------
$arr_file = $this->manageCourseFile('course_sponsor_logo', $_POST["old_course_sponsor_logo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_sponsor_logo']), true);
$error |= $arr_file['error'];
$quota_exceeded |= $arr_file['quota_exceeded'];
$file_sponsor = $arr_file['filename'];
$used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
$old_file_size += $arr_file['old_size'];
// course logo-----------------------------------------------------------------------------------
$arr_file = $this->manageCourseFile('course_logo', $_POST["old_course_logo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_logo']), true);
$error |= $arr_file['error'];
$quota_exceeded |= $arr_file['quota_exceeded'];
$file_logo = $arr_file['filename'];
$used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
$old_file_size += $arr_file['old_size'];
// ----------------------------------------------------------------------------------------------
sl_close_fileoperations();
$date_begin = Format::dateDb($_POST['course_date_begin'], "date");
$date_end = Format::dateDb($_POST['course_date_end'], "date");
if ($_POST["can_subscribe"] == "2") {
$sub_start_date = Format::dateDb($_POST["sub_start_date"], "date");
$sub_end_date = Format::dateDb($_POST["sub_end_date"], "date");
}
$hour_begin = '-1';
$hour_end = '-1';
if ($_POST['hour_begin']['hour'] != '-1') {
$hour_begin = strlen($_POST['hour_begin']['hour']) == 1 ? '0' . $_POST['hour_begin']['hour'] : $_POST['hour_begin']['hour'];
if ($_POST['hour_begin']['quarter'] == '-1') {
$hour_begin .= ':00';
} else {
$hour_begin .= ':' . $_POST['hour_begin']['quarter'];
//.........这里部分代码省略.........
示例9: saveElement
/**
* @return bool true if the operation was successfull false otherwise
*
* @access public
*/
function saveElement($regroup)
{
if ($regroup == 'templ_man') {
return $this->_saveTemplateManager();
}
if ($regroup == 'suiteman') {
return $this->_saveSuiteManager();
}
$reSetting = sql_query("\r\n\t\tSELECT param_name, value_type, extra_info\r\n\t\tFROM " . $this->table . "\r\n\t\tWHERE regroup = '" . $regroup . "' AND hide_in_modify = '0'");
$re = true;
while (list($var_name, $value_type, $extra_info) = sql_fetch_row($reSetting)) {
switch ($value_type) {
case "menuvoice":
require_once $GLOBALS['where_framework'] . '/lib/lib.menu.php';
$menu_man = new MenuManager();
if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) {
$menu_man->addPerm(ADMIN_GROUP_GODADMIN, '/lms/admin' . $extra_info);
$new_value = 1;
} else {
$menu_man->removePerm(ADMIN_GROUP_GODADMIN, '/lms/admin' . $extra_info);
$new_value = 0;
}
break;
case "menuvoice_course_public":
$after_reload_perm = true;
require_once $GLOBALS['where_framework'] . '/lib/lib.menu.php';
$menu_man = new MenuManager();
if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) {
$perm = explode(';', $extra_info);
foreach ($perm as $k => $perm_suffix) {
$menu_man->addPerm('/oc_0', '/lms/course' . trim($perm_suffix));
}
$new_value = 1;
} else {
$perm = explode(';', $extra_info);
foreach ($perm as $k => $perm_suffix) {
$menu_man->removePerm('/oc_0', '/lms/course' . trim($perm_suffix));
}
$new_value = 0;
}
break;
case "tablist_coursecatalogue":
$tab_selected = array();
foreach ($_POST['tablist'] as $tab_code => $v) {
$tab_selected[$tab_code] = 1;
}
$new_value = urlencode(serialize($tab_selected));
break;
case "tablist_mycourses":
$temp_arr = array();
for ($i = 0; $i < 3; $i++) {
$temp_var = $_POST['mycourses'][$i];
if ($temp_var != '' && !in_array($temp_var, $temp_arr)) {
//avoid repeated params
$temp_arr[] = $temp_var;
}
}
$new_value = implode(',', $temp_arr);
break;
//if is int cast it
//if is int cast it
case "language":
$lang = Docebo::langManager()->getAllLangCode();
$new_value = $lang[$_POST['option'][$var_name]];
break;
case "template":
$templ = getTemplateList();
$new_value = $templ[$_POST['option'][$var_name]];
break;
case "int":
$new_value = (int) $_POST['option'][$var_name];
break;
//if is enum switch value to on or off
//if is enum switch value to on or off
case "enum":
if (isset($_POST['option'][$var_name])) {
$new_value = 'on';
} else {
$new_value = 'off';
}
break;
case "check":
if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) {
$new_value = 1;
} else {
$new_value = 0;
}
break;
case "menuvoice":
require_once $GLOBALS['where_framework'] . '/lib/lib.menu.php';
$menu_man = new MenuManager();
if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) {
$menu_man->addPerm(ADMIN_GROUP_GODADMIN, '/framework/admin' . $extra_info);
$new_value = 1;
} else {
//.........这里部分代码省略.........
示例10: getCategoryInfo
public function getCategoryInfo($id_category)
{
//extract competence data
$query = "SELECT * FROM %lms_communication_category " . " WHERE id_category = " . (int) $id_category;
$res = $this->db->query($query);
$output = $this->db->fetch_obj($res);
//initialize languages array
$lang_codes = Docebo::langManager()->getAllLangCode();
$langs = array();
for ($i = 0; $i < count($lang_codes); $i++) {
$langs[$lang_codes[$i]] = array('name' => '', 'description' => '');
}
//extract languages from database
$query = "SELECT * FROM %lms_communication_category_lang " . " WHERE id_category = " . (int) $id_category;
$res = $this->db->query($query);
while ($obj = $this->db->fetch_obj($res)) {
if (in_array($obj->lang_code, $lang_codes)) {
$langs[$obj->lang_code]['name'] = $obj->translation;
$langs[$obj->lang_code]['description'] = "";
//$obj->description;
}
}
$output->langs = $langs;
return $output;
}
示例11: multiLangStoreDirect
function multiLangStoreDirect($id_user, $value, $is_id, $no_overwrite, $int_userid = TRUE)
{
$res = TRUE;
if ($int_userid || empty($id_user)) {
$id_user = (int) $id_user;
}
$q = sql_query("\n SELECT user_entry, language\n FROM " . $this->_getUserEntryTable() . "\n WHERE id_user = '" . $id_user . "' AND\n id_common = '" . (int) $this->id_common . "' AND\n id_common_son = '0'");
$lang_with_entry = array();
if ($q && sql_num_rows($q) > 0) {
$some_entry = TRUE;
while ($row = sql_fetch_assoc($q)) {
$lang_with_entry[] = $row["language"];
}
} else {
$some_entry = FALSE;
}
if ($some_entry) {
if ($no_overwrite) {
return $res;
}
// (TRUE)
$larr = Docebo::langManager()->getAllLangCode();
foreach ($larr as $lang) {
if (isset($value[$lang])) {
$user_entry = $value[$lang];
$user_entry = addslashes(stripslashes($user_entry));
} else {
$user_entry = "";
}
if (in_array($lang, $lang_with_entry)) {
$qtxt = "UPDATE " . $this->_getUserEntryTable() . " ";
$qtxt .= "SET user_entry = '" . $user_entry . "' ";
$qtxt .= "WHERE id_user = '" . $id_user . "' AND ";
$qtxt .= "id_common = '" . (int) $this->id_common . "' AND ";
$qtxt .= "id_common_son = '0' AND language='" . $lang . "'";
} else {
$qtxt = "INSERT INTO " . $this->_getUserEntryTable() . " ";
$qtxt .= "(id_user, id_common, id_common_son, language, user_entry) VALUES ";
$qtxt .= "(\t'" . $id_user . "', '" . (int) $this->id_common . "', '0', '" . $lang . "', ";
$qtxt .= "'" . $user_entry . "')";
}
$q = sql_query($qtxt);
if (!$q) {
$res = FALSE;
}
}
} else {
$ins_arr = array();
$qtxt = "INSERT INTO " . $this->_getUserEntryTable() . " ";
$qtxt .= "(id_user, id_common, id_common_son, language, user_entry) VALUES ";
$larr = Docebo::langManager()->getAllLangCode();
foreach ($larr as $lang) {
if (isset($value[$lang])) {
$ins_line = "(\t'" . $id_user . "', '" . (int) $this->id_common . "', '0', '" . $lang . "', ";
$ins_line .= "'" . addslashes(stripslashes($value[$lang])) . "')";
$ins_arr[] = $ins_line;
}
}
if (!empty($ins_arr)) {
$qtxt .= implode(", ", $ins_arr);
$q = sql_query($qtxt);
$res = $q ? TRUE : FALSE;
}
}
return $res;
}
示例12: lang_dropdown
public static function lang_dropdown()
{
$lang_sel = Lang::get();
$langs_var = Docebo::langManager()->getAllLanguages();
$html = Form::openForm('language_selection', '?special=changelang') . '<select id="new_lang" name="new_lang" onchange="submit();">';
foreach ($langs_var as $k => $v) {
$html .= '<option value="' . rawurlencode($v[0]) . '"' . ($v[0] == $lang_sel ? ' selected="selected"' : '') . '>' . $v[0] . '</option>';
}
$html .= '</select>' . Form::closeForm();
return $html;
}
示例13: _getAddFolderDialogContent
protected function _getAddFolderDialogContent($id_parent)
{
$languages = Docebo::langManager()->getAllLanguages(true);
//getAllLangCode();
$std_lang = getLanguage();
$form_content = Form::getHidden('addfolder_id_parent', 'id_parent', $id_parent);
//$form_content .= Form::getBreakRow();
foreach ($languages as $language) {
$lang_code = $language['code'];
$lang_name = $language['description'];
$form_content .= Form::getTextfield($lang_name, 'newfolder_' . $lang_code, 'newfolder_' . $lang_code, 50);
}
$body = Form::openForm('addfolder_form', "ajax.adm_server.php?r=alms/kb/createfolder") . '<p id="addfolder_error_message"></p>' . $form_content . Form::closeForm();
$footer = '' . Form::openButtonSpace() . Form::getButton('addfolder_save', 'addfolder_save', Lang::t('_SAVE', 'standard'), false, '', false) . Form::getButton('addfolder_undo', 'addfolder_undo', Lang::t('_UNDO', 'standard'), false, '', false) . Form::closeButtonSpace();
$output['header'] = Lang::t('_ORGCHART_ADDNODE', 'organization_chart');
$output['body'] = $body;
$output['buttons'] = array(array('text' => Lang::t('_CONFIRM', 'standard'), 'handler' => 'addfolder_save', 'isDefault' => true), array('text' => Lang::t('_UNDO', 'standard'), 'handler' => 'addfolder_undo'));
$output['script'] = '
YAHOO.util.Event.addListener("addfolder_form", "submit", function(e) { YAHOO.util.stopEvent(e); });
var addfolder_undo = function(e) { Dialog_add_folder_dialog.hide(); };
var addfolder_save = function(e) {
var id_parent = YAHOO.util.Dom.get("addfolder_id_parent").value;
var list = YAHOO.util.Selector.query("input[id^=newfolder_]"), postdata = ["id_parent="+id_parent];
for (var i=0; i<list.length; i++) {
postdata.push("langs["+list[i].name.split("_")[1]+"]="+list[i].value);
}
YAHOO.util.Connect.asyncRequest("POST", YAHOO.util.Dom.get("addfolder_form").action, {
success: function(o) {
var res = YAHOO.lang.JSON.parse(o.responseText);
if (res.success) {
for (var i=0; i<list.length; i++) list[i].value = "";
if (res.node) {
parent = TreeView_kbtree._getNodeById(res.id_parent);
TreeView_kbtree.appendNode(parent, res.node, false);
}
Dialog_add_folder_dialog.hide();
} else {
YAHOO.util.Dom.get("addfolder_error_message").innerHTML = (res.message ? res.message : "error");
}
},
failure: function() {
}
}, postdata.join("&"));
};
';
return $output;
}
示例14: init_send
function init_send()
{
checkPerm('view');
require_once _base_ . '/lib/lib.upload.php';
require_once _base_ . '/lib/lib.json.php';
$json = new Services_JSON();
$savefile = '';
$max_file = Get::req('file_number', DOTY_INT, 0);
$savefile = array();
for ($i = 1; $i <= $max_file; $i++) {
if ($_FILES['file_' . $i]['error'] == 0) {
//$savefile = rand(0,100).'_'.time().'_'.$_FILES['file']['name'];
$savefile[] = $_FILES['file_' . $i]['name'];
$path = '/appCore/newsletter/';
sl_open_fileoperations();
sl_upload($_FILES['file_' . $i]['tmp_name'], $path . $_FILES['file_' . $i]['name']);
sl_close_fileoperations();
}
}
$lang_list = Docebo::langManager()->getAllLangCode();
array_unshift($lang_list, "default", "any");
$sel_lang = importVar('sel_lang');
if ($sel_lang > 0) {
$lang_selected = $lang_list[$sel_lang];
} else {
if ($sel_lang === 0) {
// Default language
$lang_selected = getLanguage();
} else {
$lang_selected = $sel_lang;
}
}
$translate_table = getTranslateTable();
$sub = translateChr($_POST["sub"], $translate_table, true);
$msg = translateChr($_POST["msg"], $translate_table, true);
$fromemail = $_POST["fromemail"];
$send_type = $_POST["send_type"];
// ..who said spring cleanings have to be done in spring??
$qtxt = "DELETE FROM " . $GLOBALS["prefix_fw"] . "_newsletter WHERE stime < (DATE_SUB(NOW(), INTERVAL 1 DAY))";
$q = sql_query($qtxt);
$qtxt = "DELETE FROM " . $GLOBALS["prefix_fw"] . "_newsletter_sendto WHERE stime < (DATE_SUB(NOW(), INTERVAL 1 DAY))";
$q = sql_query($qtxt);
$qtxt = "INSERT INTO " . $GLOBALS["prefix_fw"] . "_newsletter (sub, msg, fromemail, language, send_type, stime) ";
$qtxt .= "VALUES ('" . $sub . "', '" . $msg . "', '" . $fromemail . "', '" . $lang_selected . "', '" . $send_type . "', NOW())";
$q = sql_query($qtxt);
//echo mysql_error();
$qtxt = "SELECT LAST_INSERT_ID() as last_id FROM " . $GLOBALS["prefix_fw"] . "_newsletter";
$q = sql_query($qtxt);
$row = mysql_fetch_array($q);
$last_id = $row["last_id"];
$qtxt = "UPDATE " . $GLOBALS["prefix_fw"] . "_newsletter SET id_send='" . $last_id . "' WHERE id='{$last_id}'";
$q = sql_query($qtxt);
$url = "index.php?modname=public_newsletter_admin&op=selsendto&id_send=" . $last_id . "&load=1";
Util::jump_to($url);
}
示例15: categorize
public function categorize()
{
if (!$this->permissions['mod']) {
$this->render('invalid', array('message' => $this->_getMessage('no permission'), 'back_url' => 'index.php?r=alms/games/show'));
return;
}
$id_game = Get::req('id_game', DOTY_INT, 0);
require_once _lms_ . '/lib/lib.kbres.php';
$kbres = new KbRes();
if ($id_game > 0) {
$data = $this->model->findByPk($id_game);
$r_data = $kbres->getResourceFromItem($data['id_resource'], $data['type_of'], 'games');
}
if (isset($_POST['subcategorize_switch'])) {
$cat_sub_items = Get::pReq('subcategorize_switch', DOTY_INT);
$res_id = (int) $r_data['res_id'];
$r_env_parent_id = (int) $r_data['r_env_parent_id'];
$kbres->saveResourceSubCategorizePref($res_id, $cat_sub_items);
Util::jump_to('index.php?r=alms/games/categorize&id_game=' . $r_env_parent_id);
die;
} else {
if (isset($_POST['org_categorize_save'])) {
require_once _lms_ . '/lib/lib.kbres.php';
$res_id = Get::req('res_id', DOTY_INT, 0);
$name = Get::req('r_name', DOTY_STRING, "");
$original_name = '';
// won't update this field
$desc = Get::req('r_desc', DOTY_STRING, "");
$r_item_id = Get::req('r_item_id', DOTY_INT, 0);
$type = Get::req('r_type', DOTY_STRING, "");
$env = Get::req('r_env', DOTY_STRING, "");
$env_parent_id = Get::req('r_env_parent_id', DOTY_INT, 0);
$param = Get::req('r_param', DOTY_STRING, "");
$alt_desc = '';
$lang_id = Get::req('r_lang', DOTY_INT, "");
$lang_arr = Docebo::langManager()->getAllLangCode();
$lang = $lang_arr[$lang_id];
$force_visible = Get::req('force_visible', DOTY_INT, 0);
$is_mobile = Get::req('is_mobile', DOTY_INT, 0);
$folders = Get::req('h_selected_folders', DOTY_STRING, "");
$json_tags = Util::strip_slashes(Get::req('tag_list', DOTY_STRING, "[]"));
$kbres = new KbRes();
$res_id = $kbres->saveResource($res_id, $name, $original_name, $desc, $r_item_id, $type, $env, $env_parent_id, $param, $alt_desc, $lang, $force_visible, $is_mobile, $folders, $json_tags);
Util::jump_to('index.php?r=alms/games/show');
} else {
if (isset($_POST['org_categorize_cancel'])) {
Util::jump_to('index.php?r=alms/games/show');
} else {
if ($data['type_of'] == 'scorm' && $r_data && $r_data['sub_categorize'] == 1) {
$this->categorize_sco($id_game, $data);
} else {
$data = $this->model->findByPk($id_game);
$data['item_id'] = $id_game;
$this->render('categorize', array('id_game' => $id_game, 'data' => $data, 'r_param' => '', 'back_url' => 'index.php?r=alms/games/show', 'form_url' => 'index.php?r=alms/games/categorize&id_game=' . $id_game));
}
}
}
}
}