Exemplo n.º 1
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Piraux Sebastien <*****@*****.**>
 * @author      Lederer Guillaume <*****@*****.**>
 * @package     CLLNP
 * @since       1.8
 */
function lp_display_scorm($TABLELEARNPATHMODULE)
{
    $out = '';
    // change raw if value is a number between 0 and 100
    if (isset($_POST['newRaw']) && is_num($_POST['newRaw']) && $_POST['newRaw'] <= 100 && $_POST['newRaw'] >= 0) {
        $sql = "UPDATE `" . $TABLELEARNPATHMODULE . "`\n                SET `raw_to_pass` = " . (int) $_POST['newRaw'] . "\n                WHERE `module_id` = " . (int) $_SESSION['module_id'] . "\n                AND `learnPath_id` = " . (int) $_SESSION['path_id'];
        claro_sql_query($sql);
        $dialogBoxContent = get_lang('Minimum raw to pass has been changed');
    }
    $out .= '<hr noshade="noshade" size="1" />';
    //####################################################################################\\
    //############################### DIALOG BOX SECTION #################################\\
    //####################################################################################\\
    if (!empty($dialogBoxContent)) {
        $dialogBox = new DialogBox();
        $dialogBox->success($dialogBoxContent);
        $out .= $dialogBox->render();
    }
    // form to change raw needed to pass the exercise
    $sql = "SELECT `lock`, `raw_to_pass`\n            FROM `" . $TABLELEARNPATHMODULE . "` AS LPM\n           WHERE LPM.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'];
    $learningPath_module = claro_sql_query_fetch_all($sql);
    if (isset($learningPath_module[0]['lock']) && $learningPath_module[0]['lock'] == 'CLOSE' && isset($learningPath_module[0]['raw_to_pass'])) {
        $out .= "\n\n" . '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . '<label for="newRaw">' . get_lang('Change minimum raw mark to pass this module (percentage) : ') . '</label>' . "\n" . '<input type="text" value="' . claro_htmlspecialchars($learningPath_module[0]['raw_to_pass']) . '" name="newRaw" id="newRaw" size="3" maxlength="3" /> % ' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '</form>' . "\n\n";
    }
    return $out;
}
Exemplo n.º 2
0
 function __construct($page_object, $array_menu)
 {
     parent::__construct();
     $this->render = new Menu();
     $wsp_admin_url = WSP_ADMIN_URL;
     $menu_items = new MenuItems();
     foreach ($array_menu['MenuItems']['MenuItem'] as $menuitems) {
         eval("\$page_icon_16 = \"" . $menuitems['Menu_attr']['icon_16'] . "\";");
         if (find($menuitems['Menu_attr']['name'], "__(", 0, 0) > 0) {
             eval("\$page_title = " . $menuitems['Menu_attr']['name'] . ";");
         } else {
             eval("\$page_title = \"" . $menuitems['Menu_attr']['name'] . "\";");
         }
         eval("\$page_link = \"" . $menuitems['Menu_attr']['url'] . "\";");
         if ($menuitems['Menu_attr']['url'] == "\$wsp_admin_url/admin.html") {
             $page_title = "";
         }
         $menu_item = new MenuItem($page_title, $page_link, $page_icon_16);
         if (isset($_GET['menu'])) {
             if ($page_link == $wsp_admin_url . "/admin.html?menu=" . $_GET['menu']) {
                 $menu_item->setCurrent();
             }
         }
         $menu_items->add($menu_item);
         $sub_menu_items = new MenuItems();
         if (!isset($menuitems['MenuItems']['MenuItem'][0])) {
             $sub_menuitems = $menuitems['MenuItems'];
         } else {
             $sub_menuitems = $menuitems['MenuItems']['MenuItem'];
         }
         $nb_sub_menu = 0;
         foreach ($sub_menuitems as $menuitem) {
             eval("\$page_icon_16 = \"" . $menuitem['Menu_attr']['icon_16'] . "\";");
             if (find($menuitem['Menu_attr']['name'], "__(", 0, 0) > 0) {
                 eval("\$page_title = " . $menuitem['Menu_attr']['name'] . ";");
             } else {
                 eval("\$page_title = \"" . $menuitem['Menu_attr']['name'] . "\";");
             }
             eval("\$page_link = \"" . $menuitem['Menu_attr']['url'] . "\";");
             $sub_menu_item = new MenuItem($page_title, $page_link, $page_icon_16);
             if ($page_link == $_GET['p'] . ".html") {
                 $sub_menu_item->setCurrent();
                 $menu_item->setCurrent();
             }
             $sub_menu_items->add($sub_menu_item);
             $nb_sub_menu++;
         }
         if ($nb_sub_menu > 0) {
             $menu_item->setMenuItems($sub_menu_items);
         }
     }
     $this->render->setMenuItems($menu_items);
     $this->render->activateSupersubs();
     list($strAdminLogin, $strAdminPasswd, $strAdminRights) = getWspUserRightsInfo("admin");
     if ($strAdminLogin == "admin" && $strAdminPasswd == sha1("admin")) {
         $modalbox = new DialogBox(__(CHANGE_PASSWD), new Url($page_object->getBaseLanguageURL() . "wsp-admin/change-passwd.call"));
         $modalbox->modal()->setWidth(400);
         $page_object->addObject($modalbox);
     }
 }
Exemplo n.º 3
0
 public function Load()
 {
     if (isset($_GET['parent_dialog_level'])) {
         $this->addObject(DialogBox::closeLevel($_GET['parent_dialog_level']));
     }
     $this->render = new Object(new Picture("img/wsp-admin/update_64.png", 64, 64), "<br/>", __(UPDATE_FRAMEWORK_WAITING));
     $this->render->setAlign(Object::ALIGN_CENTER);
     $dialog_box = new DialogBox(__(UPDATE_FRAMEWORK_COMPLETE), new Url($this->getBaseLanguageURL() . "wsp-admin/update/" . $_GET['update'] . ".call"));
     $this->addObject($dialog_box->modal());
 }
Exemplo n.º 4
0
 public function onChangePasswd()
 {
     if ($this->edt_new_passwd->getValue() != "" && $this->edt_new_passwd->getValue() != "admin" && $this->edt_new_passwd->getValue() == $this->edt_confirm_passwd->getValue()) {
         if (changeWspUser("admin", $this->edt_old_passwd->getValue(), $this->edt_new_passwd->getValue(), "administrator")) {
             $this->addObject(DialogBox::closeAll());
             $result_dialogbox = new DialogBox(__(CHANGE_PASSWD), __(CHANGE_PASSWD_CONGRATULATION));
         } else {
             $result_dialogbox = new DialogBox(__(CHANGE_PASSWD), __(CHANGE_PASSWD_ERROR));
         }
     } else {
         $result_dialogbox = new DialogBox(__(CHANGE_PASSWD), __(CHANGE_PASSWD_ERROR));
     }
     $result_dialogbox->activateCloseButton();
     $this->addObject($result_dialogbox);
 }
Exemplo n.º 5
0
 public function Load()
 {
     $dialog_update = new DialogBox(__(UPDATE_FRAMEWORK), new Url($this->getBaseLanguageURL() . "wsp-admin/update/update-framework.call?update=" . $_GET['update'] . "&parent_dialog_level=" . DialogBox::getCurrentDialogBoxLevel()));
     $dialog_update->displayFormURL()->modal();
     $button_yes = new Button($this);
     $button_yes->onClickJs($dialog_update->render())->setValue(__(UPDATE_FRAMEWORK_YES));
     $button_no = new Button($this);
     $button_no->onClickJs(DialogBox::closeAll())->setValue(__(UPDATE_FRAMEWORK_NO));
     $table_yes_no = new Table();
     $table_yes_no->addRowColumns($button_yes, "&nbsp;", $button_no);
     if ($_GET['update'] == "update-wsp") {
         $warning_lbl = new Label(__(UPDATE_FRAMEWORK_WSP_WARNING));
         $warning_lbl->setColor("red")->setItalic();
         $this->render = new Object(__(UPDATE_FRAMEWORK_CONFIRM, $_GET['text']), "<br/><br/>", $warning_lbl, "<br/><br/>", $table_yes_no);
     } else {
         $this->render = new Object(__(UPDATE_FRAMEWORK_CONFIRM, $_GET['text']), "<br/><br/>", $table_yes_no);
     }
     $this->render->setAlign(Object::ALIGN_CENTER);
 }
Exemplo n.º 6
0
/**
 * Generate html code of the wiki page preview
 * @param Wiki2xhtmlRenderer wikiRenderer rendering engine
 * @param string title page title
 * @param string content page content
 * @return string html code of the preview pannel
 */
function claro_disp_wiki_preview(&$wikiRenderer, $title, $content = '')
{
    $out = "<div id=\"preview\" class=\"wikiTitle\">\n";
    if ($title === '__MainPage__') {
        $title = get_lang("Main page");
    }
    $title = "<h1 class=\"wikiTitle\">" . get_lang('Preview :') . "{$title}</h1>\n";
    $out .= $title;
    $out .= '</div>' . "\n";
    $dialogBox = new DialogBox();
    $dialogBox->warning('<small>' . get_lang("WARNING: this page is a preview. Your modifications to the wiki has not been saved yet ! To save them do not forget to click on the 'save' button at the bottom of the page.") . '</small>');
    $out .= $dialogBox->render() . "\n";
    $out .= '<div class="wiki2xhtml">' . "\n";
    if ($content != '') {
        $out .= $wikiRenderer->render($content);
    } else {
        $out .= get_lang("This page is empty, click on 'Edit this page' to add a content");
    }
    $out .= "</div>\n";
    return $out;
}
Exemplo n.º 7
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Piraux Sebastien <*****@*****.**>
 * @author      Lederer Guillaume <*****@*****.**>
 * @package     CLLNP
 * @since       1.8
 */
function lp_display_exercise($cmd, $TABLELEARNPATHMODULE, $TABLEMODULE, $TABLEASSET, $tbl_quiz_exercise)
{
    $out = '';
    if (isset($cmd) && ($cmd = "raw")) {
        // change raw if value is a number between 0 and 100
        if (isset($_POST['newRaw']) && is_num($_POST['newRaw']) && $_POST['newRaw'] <= 100 && $_POST['newRaw'] >= 0) {
            $sql = "UPDATE `" . $TABLELEARNPATHMODULE . "`\n                    SET `raw_to_pass` = " . (int) $_POST['newRaw'] . "\n                    WHERE `module_id` = " . (int) $_SESSION['module_id'] . "\n                    AND `learnPath_id` = " . (int) $_SESSION['path_id'];
            claro_sql_query($sql);
            $dialogBoxContent = get_lang('Minimum raw to pass has been changed');
        }
    }
    $out .= '<hr noshade="noshade" size="1" />';
    //####################################################################################\\
    //############################### DIALOG BOX SECTION #################################\\
    //####################################################################################\\
    if (!empty($dialogBoxContent)) {
        $dialogBox = new DialogBox();
        $dialogBox->success($dialogBoxContent);
        $out .= $dialogBox->render();
    }
    // form to change raw needed to pass the exercise
    $sql = "SELECT `lock`, `raw_to_pass`\n            FROM `" . $TABLELEARNPATHMODULE . "` AS LPM\n           WHERE LPM.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'];
    $learningPath_module = claro_sql_query_get_single_row($sql);
    // if this module blocks the user if he doesn't complete
    if (isset($learningPath_module['lock']) && $learningPath_module['lock'] == 'CLOSE' && isset($learningPath_module['raw_to_pass'])) {
        $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . claro_form_relay_context() . '<label for="newRaw">' . get_lang('Change minimum raw mark to pass this module (percentage) :') . ' </label>' . "\n" . '<input type="text" value="' . claro_htmlspecialchars($learningPath_module['raw_to_pass']) . '" name="newRaw" id="newRaw" size="3" maxlength="3" /> % ' . "\n" . '<input type="hidden" name="cmd" value="raw" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '</form>' . "\n\n";
    }
    // display current exercise info and change comment link
    $sql = "SELECT `E`.`id` AS `exerciseId`, `M`.`name`\n            FROM `" . $TABLEMODULE . "` AS `M`,\n                 `" . $TABLEASSET . "`  AS `A`,\n                 `" . $tbl_quiz_exercise . "` AS `E`\n           WHERE `A`.`module_id` = M.`module_id`\n             AND `M`.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND `E`.`id` = `A`.`path`";
    $module = claro_sql_query_get_single_row($sql);
    if ($module) {
        $out .= "\n\n" . '<h4>' . get_lang('Exercise in module') . ' :</h4>' . "\n" . '<p>' . "\n" . claro_htmlspecialchars($module['name']) . '<a href="../exercise/admin/edit_exercise.php?exId=' . $module['exerciseId'] . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . '</a>' . "\n" . '</p>' . "\n";
    }
    // else sql error, do nothing except in debug mode, where claro_sql_query_fetch_all will show the error
    return $out;
}
Exemplo n.º 8
0
 public function Load()
 {
     $this->setTimeout(0);
     if ($this->getExtractLastWspVersion()) {
         $congratulation_pic = new Picture("img/wsp-admin/button_ok_64.png", 64, 64);
         $this->render = new Object($congratulation_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_OK, "WebSite-PHP"));
     } else {
         $error_pic = new Picture("img/wsp-admin/button_not_ok_64.png", 64, 64);
         $this->render = new Object($error_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_NOT_OK, "WebSite-PHP"));
     }
     $button_ok = new Button($this);
     $button_ok->setValue("OK");
     $button_ok->onClickJs(DialogBox::closeAll() . "location.href=location.href;");
     $this->render->add("<br/><br/>", $button_ok);
     $this->render->setAlign(Object::ALIGN_CENTER);
 }
Exemplo n.º 9
0
 public function Load()
 {
     unset($_SESSION['user_browscap_version']);
     if ($this->updateBrowscapFile()) {
         $congratulation_pic = new Picture("img/wsp-admin/button_ok_64.png", 64, 64);
         $this->render = new Object($congratulation_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_OK, "Browscap.ini"));
     } else {
         $error_pic = new Picture("img/wsp-admin/button_not_ok_64.png", 64, 64);
         $this->render = new Object($error_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_NOT_OK, "Browscap.ini"));
     }
     $button_ok = new Button($this);
     $button_ok->setValue("OK");
     $button_ok->onClickJs(DialogBox::closeAll() . "location.href=location.href;");
     $this->render->add("<br/><br/>", $button_ok);
     $this->render->setAlign(Object::ALIGN_CENTER);
     // refresh the page
     $this->addObject(new JavaScript("setTimeout('location.href=location.href;', 1000);"));
 }
Exemplo n.º 10
0
    $out .= disp_forum_breadcrumb($pagetype, $forumSettingList['forum_id'], $forumSettingList['forum_name']);
}
if ('show' != $cmd) {
    if ('default' == $anonymityStatus) {
        $info = '<tr valign="top">' . "\n" . '<td>&nbsp;</td>' . '<td><strong>' . get_lang('Contributions to this forum are anonymous by default!<br/>') . get_lang('If you want to sign your post all the same, uncheck the checkbox above the "OK" button') . '</strong></td>' . '</tr>' . '<tr style="height:1px;"><td colspan="2">&nbsp;</td></tr>';
    } elseif ('allowed' == $anonymityStatus) {
        $info = '<tr valign="top">' . "\n" . '<td>&nbsp;</td>' . '<td><strong>' . get_lang('This forum allows anonymous contributions!<br/>') . get_lang('If you do not want to sign your post, check the checkbox above the "OK" button') . '</strong></td>' . '</tr>' . '<tr style="height:1px;"><td colspan="2">&nbsp;</td></tr>';
    }
    if (!empty($info)) {
        $dialogBox->info($info);
    }
}
$out .= $dialogBox->render();
//display edit form if any
if (isset($form)) {
    $formBox = new DialogBox();
    $formBox->form($form->render());
    $out .= $formBox->render() . '<hr />';
}
//display topic review if any
if ($topicSettingList) {
    // get post and use pager
    if (!$viewall) {
        $postLister = new postLister($topicId, $start, get_conf('posts_per_page'));
    } else {
        $postLister = new postLister($topicId, $start, get_total_posts($topicId, 'topic'));
        $incrementViewCount = false;
    }
    // get post and use pager
    $postList = $postLister->get_post_list();
    $totalPosts = $postLister->sqlPager->get_total_item_count();
Exemplo n.º 11
0
require_once get_path('incRepositorySys') . "/lib/fileManage.lib.php";
require_once get_path('incRepositorySys') . "/lib/fileUpload.lib.php";
// clean exercise session vars
unset($_SESSION['serializedExercise']);
unset($_SESSION['serializedQuestionList']);
unset($_SESSION['exeStartTime']);
if (!empty($_REQUEST['copyFrom']) && $is_allowedToEdit) {
    $_SESSION['returnToTrackingUserId'] = (int) $_GET['copyFrom'];
    $copyError = false;
    //we could simply copy the requested module progression...
    //but since we can navigate between modules while completing a module,
    //we have to copy the whole learning path progression.
    if (!copyLearnPathProgression((int) $_SESSION['returnToTrackingUserId'], (int) claro_get_current_user_id(), (int) $_SESSION['path_id'])) {
        $copyError = true;
    }
    $dialogBox = new DialogBox();
    if ($copyError) {
        $dialogBox->error(get_lang('An error occured while accessing student module'));
        $claroline->display->body->appendContent($dialogBox->render());
        echo $claroline->display->render();
        exit;
    } else {
        $user_data = user_get_properties((int) $_SESSION['returnToTrackingUserId']);
        $dialogBox->success(get_lang('Currently viewing module of ') . $user_data['firstname'] . ' ' . $user_data['lastname']);
        unset($user_data);
    }
    unset($copyError);
} else {
    unset($_SESSION['returnToTrackingUserId']);
}
// main page
Exemplo n.º 12
0
require '../../inc/claro_init_global.inc.php';
//SECURITY CHECK
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
//DECLARE NEEDED LIBRARIES
require_once get_path('incRepositorySys') . '/lib/pager.lib.php';
require_once get_path('incRepositorySys') . '/lib/module/manage.lib.php';
//SQL table name
$tbl_name = claro_sql_get_main_tbl();
$tbl_module = $tbl_name['module'];
$tbl_dock = $tbl_name['dock'];
$dialogBox = new DialogBox();
if (isset($_REQUEST['dock'])) {
    $dockList = get_dock_list('applet');
    $dock = $_REQUEST['dock'];
    $dockName = isset($dockList[$dock]) ? $dockList[$dock] : $dock;
    $nameTools = get_lang('Dock') . ' : ' . $dockName;
} else {
    $dock = null;
    $dialogBox->error(get_lang('No dock selected'));
    $nameTools = get_lang('Dock');
}
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Module list'), get_path('rootAdminWeb') . 'module/module_list.php');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
//CONFIG and DEVMOD vars :
$modulePerPage = get_conf('moduleDockPerPage', 10);
//----------------------------------
Exemplo n.º 13
0
 /**
  * Method getAjaxRender
  * @access public
  * @return string javascript code to update initial html with ajax call
  * @since 1.0.35
  */
 public function getAjaxRender()
 {
     if ($this->object_change && !$this->is_new_object_after_init) {
         $alert_box = new DialogBox("Ajax Error", "Warning: No Ajax render for object " . get_class($this), '');
         return $alert_box->render(true);
     }
 }
Exemplo n.º 14
0
// $Id: get_attachment.php 14064 2012-03-19 15:10:37Z zefredz $
/**
 * CLAROLINE
 *
 * @version     $Revision: 14064 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Claro Team <*****@*****.**>
 */
$tlabelReq = 'CLQWZ';
require '../inc/claro_init_global.inc.php';
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
$dialogBox = new DialogBox();
$is_allowedToEdit = claro_is_allowed_to_edit();
// tool libraries
include_once './lib/exercise.class.php';
include_once './lib/question.class.php';
include_once './lib/exercise.lib.php';
include_once get_path('incRepositorySys') . '/lib/file.lib.php';
// init request vars
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} else {
    $id = null;
}
$item_list = explode('_', $id);
if (isset($item_list['0'])) {
    $cmd = $item_list['0'];
Exemplo n.º 15
0
 * @version     $Revision: 14429 $
 * @copyright   2001-2011 Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @see         http://www.claroline.net/wiki/index.php/CLGRP
 * @package     CLGRP
 * @author      Claro Team <*****@*****.**>
 */
$cidNeeded = true;
$gidNeeded = true;
$tlabelReq = 'CLGRP';
require '../inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys') . '/lib/group.lib.inc.php';
require_once dirname(__FILE__) . '/../messaging/lib/permission.lib.php';
$toolNameList = claro_get_tool_name_list();
$toolRepository = get_path('clarolineRepositoryWeb');
$dialogBox = new DialogBox();
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
// block if !claro_is_in_a_group()
// accept  if claro_is_group_allowed()
if (!claro_is_allowed_to_edit()) {
    if (!claro_is_in_a_group()) {
        claro_redirect('group.php');
        exit;
    } elseif (!claro_is_group_allowed() && !(isset($_REQUEST['selfReg']) || isset($_REQUEST['doReg']))) {
        claro_redirect('group.php');
        exit;
    }
}
// use viewMode
Exemplo n.º 16
0
    $quId = null;
}
if (isset($_REQUEST['filter'])) {
    $filter = $_REQUEST['filter'];
} else {
    $filter = 'all';
}
$categoryId = substr($filter, 0, 10) == 'categoryId' && is_numeric(substr($filter, 10)) ? substr($filter, 10) : null;
/*
 * Init other vars
 */
$exercise = new Exercise();
if (!is_null($exId)) {
    $exercise->load($exId);
}
$dialogBox = new DialogBox();
/*
 * Execute commands
 */
// use question in exercise
if ($cmd == 'rqUse' && !is_null($quId) && !is_null($exId)) {
    if ($exercise->addQuestion($quId)) {
        // TODO show confirmation and back link
        header('Location: ' . Url::Contextualize('edit_exercise.php?exId=' . $exId));
    }
}
// delete question
if ($cmd == 'delQu' && !is_null($quId)) {
    $question = new Question();
    if ($question->load($quId)) {
        if (!$question->delete()) {
 /**
  * Method getAjaxEventFunctionRender
  * @access protected
  * @return string
  * @since 1.0.35
  */
 protected function getAjaxEventFunctionRender()
 {
     $html = "";
     $loading_obj = null;
     if (get_class($this) == "UploadFile") {
         $loading_obj = $this->getProgressBarObject();
         if ($this->isSizeLimitJsCheckActivated() && $this->getFileSizeLimit() != -1) {
             $size_alert = new DialogBox(__(ERROR), __(UPLOAD_FILESIZE_LIMIT_ERROR_MSG, $this->getFileSizeLimitStr()));
             $size_alert->activateCloseButton()->setWidth(500);
             $size_alert->setDialogBoxLevel(rand(90000, 99999));
             $html .= "var displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = function(filename) {\n";
             $html .= $size_alert->render();
             $html .= "};\n";
         } else {
             $html .= "var displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = null;\n";
         }
         if ($this->isMimeTypeJsCheckActivated() && sizeof($this->getAuthorizedMimeTypes()) > 0) {
             $mime_alert = new DialogBox(__(ERROR), __(UPLOAD_MIME_TYPES_ERROR_MSG, implode(", ", $this->getAuthorizedMimeTypes())));
             $mime_alert->activateCloseButton()->setWidth(500);
             $mime_alert->setDialogBoxLevel(rand(90000, 99999));
             $html .= "var displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = function(filename, mime_type) {\n";
             $html .= $mime_alert->render();
             $html .= "};\n";
         } else {
             $html .= "var displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . " = null;\n";
         }
     }
     if (gettype($this->ajax_wait_message) != "object") {
         $loading_img = new Picture("wsp/img/loading.gif", 32, 32);
         $loading_img->setId("wspAjaxEventLoadingPic" . get_class($this) . "_" . $this->getEventObjectName());
         $loading_modalbox = new DialogBox(__(LOADING), new Object($this->ajax_wait_message, "<br/>", $loading_img, $loading_obj));
         $loading_modalbox->setDialogBoxLevel(rand(90000, 99999))->modal();
     }
     $error_alert = new DialogBox(__(ERROR), __(SUBMIT_ERROR));
     $error_alert->activateCloseButton()->setWidth(500);
     $error_alert->setDialogBoxLevel(rand(90000, 99999));
     $error_unknow_alert = new DialogBox(__(ERROR), __(SUBMIT_UNKNOW_ERROR));
     $error_unknow_alert->activateCloseButton()->setWidth(400);
     $error_unknow_alert->setDialogBoxLevel(rand(90000, 99999));
     $html .= "\tvar isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
     $html .= "\tvar lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " = Array();\n";
     $html .= "\tvar nbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " = 0;\n";
     if ($this->is_ajax_event) {
         $html .= "\tvar encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . " = Array();\n";
     }
     $html .= "\tcallAjax" . get_class($this) . "_" . $this->getEventObjectName() . "_event = function(callback_value, abort_last_request) {\n";
     $html .= "\t\tif (isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " && !abort_last_request) { return; }\n";
     $html .= "\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = true;\n";
     $html .= "\t\tnbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "++;\n";
     if (!$this->disable_ajax_wait_message) {
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'block');\n";
         } else {
             $html .= "\t\t" . $loading_modalbox->render() . "\n";
         }
         $html .= "\t\tsetTimeout(\"requestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . "(\\\"\" + callback_value + \"\\\", \" + abort_last_request + \");\", " . (gettype($this->ajax_wait_message) == "object" ? "1" : "1000") . ");\n";
     } else {
         $html .= "\t\tsetTimeout(\"requestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . "(\\\"\" + callback_value + \"\\\", \" + abort_last_request + \");\", (abort_last_request?(lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length==0?1:200):1));\n";
     }
     $html .= "\t};\n";
     $html .= "\trequestAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = function(callback_value, abort_last_request) {\n";
     $html .= "\t\tnbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "--;\n";
     $html .= "\t\tif (abort_last_request) { for (var i=0; i < lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length; i++) { if (lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i]!=null) { lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i].abort(); lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[i]=null; } } if (nbAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . " > 0) { return; } }\n";
     // encrypt formular if encrypt is active
     if ($this->form_object != null) {
         $html .= "\t\t" . $this->encryptObjectData($this->form_object, "isRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;" . ($loading_modalbox == null ? "" : $loading_modalbox->close()->render()));
     }
     if (get_class($this) == "UploadFile") {
         $html .= "var upload_status = \$('#" . $this->getId() . "').upload('";
     } else {
         $html .= "\t\tlastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . "[lastAjaxRequest" . get_class($this) . "_" . $this->getEventObjectName() . ".length] = \$.ajax({ type: '";
         if ($this->form_object != null) {
             $html .= $this->form_object->getMethod();
         } else {
             $html .= "POST";
         }
         $html .= "', url: '";
     }
     $html .= BASE_URL . LANGUAGE_URL . "/ajax/";
     if ($this->form_object == null) {
         $html .= $this->getPage()->getPage() . ".html";
         if (PARAMS_URL != "") {
             $pos = find(PARAMS_URL, "?", 0, $pos);
             if ($pos > 0) {
                 $pos2 = strlen(PARAMS_URL);
                 $html .= "?" . substr(PARAMS_URL, $pos, $pos2 - $pos);
             }
         }
     } else {
         if ($this->form_object->getAction() == "") {
             $html .= $this->form_object->getPageObject()->getPage() . ".html";
             if (PARAMS_URL != "") {
                 $pos = find(PARAMS_URL, "?", 0, $pos);
                 if ($pos > 0) {
                     $pos2 = strlen(PARAMS_URL);
                     $html .= "?" . substr(PARAMS_URL, $pos, $pos2 - $pos);
                 }
             }
         } else {
             $html .= $this->form_object->getAction();
         }
     }
     $html .= "',\n";
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').serialize(),\n";
     } else {
         if ($this->form_object != null) {
             $html .= "\t\t\tdata: ";
             if ($this->form_object->isEncrypted()) {
                 $html .= "encrypt_data";
             } else {
                 $html .= "\$('#" . $this->form_object->getId() . "').serialize() + '&Callback_" . $this->getEventObjectName() . "=' + callback_value";
             }
             $html .= ",\n";
         } else {
             $html .= "\t\t\tdata: 'Callback_" . $this->getEventObjectName() . "=' + callback_value,\n";
         }
         $html .= "\t\t\tdataType: 'json',\n";
         $html .= "\t\t\tsuccess: ";
     }
     $html .= "function(ajax_event_response) {\n";
     $html .= "\t\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
     $html .= "\t\t\t\tif (ajax_event_response != \"\") {\n";
     $html .= "\t\t\t\t\tvar dialogbox_is_change = false;\n";
     if (isLocalDebug()) {
         $html .= "\t\t\t\t\tvar alert_local_eval_error = true;\n";
     }
     $html .= "\t\t\t\t\tfor (var ajax_event_ind=0; ajax_event_ind < ajax_event_response.length; ajax_event_ind++) {\n";
     if (!$this->disable_ajax_wait_message) {
         $html .= "\t\t\t\t\t\tif (ajax_event_response[ajax_event_ind] != null && ajax_event_response[ajax_event_ind].indexOf('wspDialogBox" . $modalbox_indice . "' + ' = ') != -1) {\n";
         $html .= "\t\t\t\t\t\t\tdialogbox_is_change = true;\n";
         $html .= "\t\t\t\t\t\t}\n";
     }
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t\t\t\tajax_event_response[ajax_event_ind] = myReplaceAll(myReplaceAll(ajax_event_response[ajax_event_ind], '{#wsp_lt}', '<'), '{#wsp_gt}', '>');\n";
     }
     $html .= "\t\t\t\t\t\ttry {\n";
     $html .= "\t\t\t\t\t\t\teval(ajax_event_response[ajax_event_ind]);\n";
     $html .= "\t\t\t\t\t\t} catch (e) {\n";
     $html .= "\t\t\t\t\t\t\tconsole.log('Js error: ' + e.message + '\\nCode: ' + ajax_event_response[ajax_event_ind]);\n";
     // display ajax render error message when it's local or debug execution (useful to debug)
     if (isLocalDebug()) {
         $html .= "\t\t\t\t\t\t\tif (alert_local_eval_error) {\n";
         $html .= "\t\t\t\t\t\t\t\talert('An error appeared during Ajax event, please check the console of your browser to see the error(s).');";
         $html .= "\t\t\t\t\t\t\t\talert_local_eval_error = false;\n";
         $html .= "\t\t\t\t\t\t\t}\n";
     }
     $html .= "\t\t\t\t\t\t}\n";
     $html .= "\t\t\t\t\t}\n";
     if (!$this->disable_ajax_wait_message) {
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\tif (!dialogbox_is_change) {\n";
             $html .= "\t\t\t\t\t\t" . $loading_modalbox->close()->render();
             $html .= "\t\t\t\t\t}\n";
         }
     }
     $html .= "\t\t\t\t} else {\n";
     if (gettype($this->ajax_wait_message) == "object") {
         $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
     } else {
         $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render();
     }
     $html .= "\t\t\t\t\t" . $error_unknow_alert->render() . "\n";
     $html .= "\t\t\t\t}\n";
     $html .= "\t\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').val('');\n";
     if ($this->is_ajax_event) {
         $html .= "\t\t\t\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . "();\n";
     }
     $html .= "\t\t\t},\n";
     if (get_class($this) == "UploadFile") {
         $html .= "\t\t\t'json', \$('#wsp_object_wspAjaxEventLoadingObj" . get_class($this) . "_" . $this->getEventObjectName() . "'), \$('#wspAjaxEventLoadingPic" . get_class($this) . "_" . $this->getEventObjectName() . "'), displaySizeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . ", '" . $this->getFileSizeLimit() . "', displayMimeErrorDialogBox" . get_class($this) . "_" . $this->getEventObjectName() . ", '" . implode(", ", $this->getAuthorizedMimeTypes()) . "');\n";
         $html .= "\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
         $html .= "\t\t\tif (upload_status === false) {\n";
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render() . "\n";
         }
         $html .= "\t\t\t}\n";
     } else {
         $html .= "\t\t\terror: function(transport) {\n";
         $html .= "\t\t\t\tisRequestedAjaxEvent" . get_class($this) . "_" . $this->getEventObjectName() . " = false;\n";
         $html .= "\t\t\t\tif (!abort_last_request || (abort_last_request && trim(transport.statusText) != 'abort')) {\n";
         if (gettype($this->ajax_wait_message) == "object") {
             $html .= "\t\t\t\t\t\$('#" . $this->ajax_wait_message->getId() . "').css('display', 'none');\n";
         } else {
             $html .= "\t\t\t\t\t" . $loading_modalbox->close()->render() . "\n";
         }
         $html .= "\t\t\t\t\tif (trim(transport.responseText) == '') {\n";
         $html .= "\t\t\t\t\t\t" . $error_unknow_alert->render();
         $html .= "\t\t\t\t\t} else {\n";
         $html .= "\t\t\t\t\t\t" . $error_alert->render();
         $html .= "\t\t\t\t\t}\n";
         $html .= "\t\t\t\t}\n";
         $html .= "\t\t\t\t\$('#Callback_" . $this->getEventObjectName() . "').val('');\n";
         if ($this->is_ajax_event) {
             $html .= "\t\t\t\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . "();\n";
         }
         $html .= "\t\t\t}\n";
     }
     if (get_class($this) != "UploadFile") {
         $html .= "\t\t});\n";
     }
     $html .= "\t};\n";
     if ($this->is_ajax_event) {
         $html .= "\trestoreEncryptedObject" . get_class($this) . "_" . $this->getEventObjectName() . " = function() {\n";
         $html .= "\t\tfor (var i=0; i < encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . ".length; i++) {\n";
         $html .= "\t\t\t\$('#' + encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . "[i][0]).val(encryptedObjectValueArray" . get_class($this) . "_" . $this->getEventObjectName() . "[i][1]);\n";
         $html .= "\t\t}\n";
         $html .= "\t};\n";
     }
     return $html;
 }
Exemplo n.º 18
0
/**
* Display list of messages in substyled boxes in a message_box
*
* In most of cases  function message_box() is enough.
*
* @param array $msgArrBody of array of blocs containing array of messages
* @author Christophe Gesche <*****@*****.**>
* @version 1.0
* @see  message_box()
*
*  code for using this    in your    tools:
*  $msgArrBody["nameOfCssClass"][]="foo";
*  css    class can be defined in    script but try to use
*  class from    generic    css    ()
*  error success warning
*  ...
*
* @todo this must be a message object where code add messages with a priority,
* and the rendering is set by by priority
*
*/
function claro_html_msg_list($msgArrBody, $return = true)
{
    $msgBox = '';
    if (is_array($msgArrBody) && count($msgArrBody) > 0) {
        foreach ($msgArrBody as $classMsg => $thisMsgArr) {
            if (is_array($thisMsgArr)) {
                $msgBox .= '<div class="' . $classMsg . '">';
                foreach ($thisMsgArr as $anotherThis) {
                    $msgBox .= '<div class="msgLine" >' . $anotherThis . '</div>';
                }
                $msgBox .= '</div>';
            } else {
                $msgBox .= '<div class="' . $classMsg . '">';
                $msgBox .= '<div class="msgLine" >' . $thisMsgArr . '</div>';
                $msgBox .= '</div>';
            }
        }
    }
    $dialogBox = new DialogBox();
    if ($msgBox) {
        $dialogBox->form($msgBox);
    }
    if ($return) {
        return $dialogBox->render();
    } else {
        echo $dialogBox->render();
    }
    return true;
}
Exemplo n.º 19
0
unset($_SESSION['userEdit']);
$nameTools = get_lang('User course settings');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
// see which user we are working with ...
if (isset($_REQUEST['uidToEdit']) && isset($_REQUEST['cidToEdit'])) {
    $uidToEdit = (int) $_REQUEST['uidToEdit'];
    $cidToEdit = strip_tags($_REQUEST['cidToEdit']);
} else {
    claro_die('Missing parameters');
}
$courseData = claro_get_course_data($cidToEdit);
if (!$courseData) {
    unset($_REQUEST['cidToEdit']);
    claro_die('ERROR : COURSE NOT FOUND!!!');
}
$dialogBox = new DialogBox();
//------------------------------------
// Execute COMMAND section
//------------------------------------
//Display "form and info" about the user
$ccfrom = isset($_REQUEST['ccfrom']) ? $_REQUEST['ccfrom'] : '';
$cfrom = isset($_REQUEST['cfrom']) ? $_REQUEST['cfrom'] : '';
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
switch ($cmd) {
    case 'exUpdateCourseUserProperties':
        if (isset($_REQUEST['profileId'])) {
            $properties['profileId'] = $_REQUEST['profileId'];
        }
        if (isset($_REQUEST['isTutor'])) {
            $properties['tutor'] = (int) $_REQUEST['isTutor'];
        } else {
Exemplo n.º 20
0
require claro_get_conf_repository() . 'ical.conf.php';
require claro_get_conf_repository() . 'rss.conf.php';
claro_set_display_mode_available(true);
// Set flag following depending on settings
$is_allowedToEdit = claro_is_allowed_to_edit();
$courseId = claro_get_current_course_id();
$userLastLogin = claro_get_current_user_data('lastLogin');
// DB tables definition
$tbl_cdb_names = claro_sql_get_main_tbl();
$tbl_course_user = $tbl_cdb_names['rel_course_user'];
$tbl_user = $tbl_cdb_names['user'];
// Default display
$displayForm = false;
$displayList = true;
$subTitle = '';
$dialogBox = new DialogBox();
// avoid executing commands twice when switching view mode
if (isset($_REQUEST['viewMode'])) {
    unset($_REQUEST['cmd']);
    unset($_REQUEST['id']);
}
/**
 * COMMANDS SECTION (COURSE MANAGER ONLY)
 */
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$cmd = isset($_REQUEST['cmd']) ? $cmd = $_REQUEST['cmd'] : '';
if ($is_allowedToEdit) {
    if (isset($_REQUEST['cmd']) && ($_REQUEST['cmd'] == 'rqCreate' || $_REQUEST['cmd'] == 'rqEdit')) {
        if ('rqEdit' == $_REQUEST['cmd']) {
            $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $_REQUEST['id']));
            ResourceLinker::setCurrentLocator($currentLocator);
Exemplo n.º 21
0
if (isset($_REQUEST['cid'])) {
    $cidReq = $_REQUEST['cid'];
} elseif (isset($_REQUEST['cidReq'])) {
    $cidReq = $_REQUEST['cidReq'];
}
$portletCmd = isset($_REQUEST['portletCmd']) ? $_REQUEST['portletCmd'] : null;
$portletId = isset($_REQUEST['portletId']) ? $_REQUEST['portletId'] : null;
$portletLabel = isset($_REQUEST['portletLabel']) ? $_REQUEST['portletLabel'] : null;
$portletClass = isset($portletLabel) ? $portletLabel . '_portlet' : null;
require '../inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php';
require_once get_path('incRepositorySys') . '/lib/users/userlist.lib.php';
require_once dirname(__FILE__) . '/coursehomepage/lib/coursehomepageportlet.class.php';
require_once dirname(__FILE__) . '/coursehomepage/lib/coursehomepageportletiterator.class.php';
// Instanciate dialog box
$dialogBox = new DialogBox();
// Display the auth form if necessary
// Also redirect if no cid specified
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
if (empty($cidReq)) {
    claro_die(get_lang('Cannot find course'));
}
// Fetch this course's portlets
$portletiterator = new CourseHomePagePortletIterator(ClaroCourse::getIdFromCode($cidReq));
// Include specific CSS if any
if (file_exists(get_conf('coursesRepositorySys') . $_course['path'] . '/css/course.css')) {
    $claroline->display->header->addHtmlHeader('<link rel="stylesheet" media="screen" type="text/css" href="' . get_path('url') . '/' . get_path('coursesRepositoryAppend') . $_course['path'] . '/css/course.css" />');
}
// Instantiate course
Exemplo n.º 22
0
    claro_die(get_lang('Not allowed'));
}
if (isset($_REQUEST['cidToEdit']) && $_REQUEST['cidToEdit'] == '' || !isset($_REQUEST['cidToEdit'])) {
    unset($_REQUEST['cidToEdit']);
    claro_die('ERROR : NO COURSE SET!!!');
} else {
    $cidToEdit = strip_tags($_REQUEST['cidToEdit']);
}
$userPerPage = 20;
// numbers of user to display on the same page
//get needed parameter from URL
$user_id = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null;
if ($cidToEdit == '') {
    claro_die('ERROR : NO USER SET!!!');
}
$dialogBox = new DialogBox();
// Deal with interbredcrumps
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$nameTools = get_lang('Enroll a user');
//TABLES
$tbl_mdb_names = claro_sql_get_main_tbl();
$tbl_user = $tbl_mdb_names['user'];
$tbl_courses = $tbl_mdb_names['course'];
$tbl_course_user = $tbl_mdb_names['rel_course_user'];
// See SESSION variables used for reorder criteria :
if (isset($_REQUEST['dir'])) {
    $_SESSION['admin_register_dir'] = $_REQUEST['dir'];
}
if (isset($_REQUEST['order_crit'])) {
    $_SESSION['admin_register_order_crit'] = $_REQUEST['order_crit'];
}
Exemplo n.º 23
0
    $CssLoader->load('ui.datepicker');
    $JsLoader->load('ui.datepicker');
    $javascript = '
        <script type="text/javascript" charset="utf-8">
            $(document).ready( function(){
                $(".daterange").datepicker({dateFormat: \'dd/mm/yy\', beforeShow: customRange});
                
                function customRange(input) {
                    return {minDate: (input.id == \'dateinput2\' ? $(\'#dateinput1\').datepicker(\'getDate\') : null),
                    maxDate: (input.id == \'dateinput1\' ? $(\'#dateinput2\').datepicker(\'getDate\') : null)};
                }
            });
        </script>';
    $claroline->display->header->addHtmlHeader($javascript);
    $disp = "\n" . get_lang('Select interval') . '<br />' . "\n" . '<form action="' . $_SERVER['PHP_SELF'] . '?search=timeInterval" method="post">' . "\n" . get_lang('From') . ' <input type="text" name="date1" value="' . $date1 . '" class="daterange" id="dateinput1" /> ' . "\n" . get_lang('to') . ' <input type="text" name="date2" value="' . $date2 . '" class="daterange" id="dateinput2" /> ' . get_lang('(jj/mm/aaaa)') . '<br />' . "\n" . '<input type="submit" value="' . get_lang('Search') . '" />' . "\n" . '</form>' . "\n\n";
    $dialogbox = new DialogBox();
    $dialogbox->form($disp);
    $content .= $dialogbox->render();
}
if ($displayTable) {
    $argLink = makeArgLink($arguments, array('fieldOrder', 'order'));
    $orderLink = $_SERVER['PHP_SELF'] . '?' . $argLink;
    if ($argLink != "") {
        $orderLink .= "&amp;";
    }
    $orderLink .= "order=" . $nextOrder . "&amp;";
    $javascriptDelete = '
    <script type="text/javascript">
  
        function deleteSelection ()
        {
Exemplo n.º 24
0
 /**
  * Method getSynchronizeModelObject
  * @access public
  * @return mixed
  * @since 1.2.1
  */
 public function getSynchronizeModelObject()
 {
     $list_attribute = $this->database_object->getDbTableAttributes();
     $key_attributes = $this->database_object->getDbTablePrimaryKeys();
     $list_attribute_type = $this->database_object->getDbTableAttributesType();
     $is_insert = !$this->database_model_object->isDbObject();
     $error = false;
     foreach ($this->fields_array as $attribute => $field) {
         if ((!in_array($attribute, $key_attributes) || $is_insert) && in_array(get_class($field), $this->objects_ok_array)) {
             $value = $field->getValue();
             $search_pos = array_search($attribute, $list_attribute);
             if ($search_pos !== false && $value != "") {
                 settype($value, $list_attribute_type[$search_pos]);
                 if ("" . $value != "" . $field->getValue() && get_class($field) != "CheckBox") {
                     $error_dialog = new DialogBox(__(ERROR), "Can't convert " . $field->getValue() . " to " . $list_attribute_type[$search_pos]);
                     $this->page_object->addObject($error_dialog->activateCloseButton());
                     $error = true;
                 }
             }
             if ($value == "") {
                 if (get_class($field) == "CheckBox") {
                     $value = 0;
                 } else {
                     $value = null;
                 }
             }
             $method = "set" . $this->getFormatValue($attribute);
             call_user_func_array(array($this->database_model_object, $method), array($value));
         }
     }
     return $error ? false : $this->database_model_object;
 }
Exemplo n.º 25
0
$tbl_group_team = $tbl_cdb_names['group_team'];
$tbl_group_rel_team_user = $tbl_cdb_names['group_rel_team_user'];
$currentUserFirstName = claro_get_current_user_data('firstName');
$currentUserLastName = claro_get_current_user_data('lastName');
// 'step' of pager
$usersPerPage = get_conf('usersPerPage', 20);
// use viewMode
claro_set_display_mode_available(true);
/*============================================================================
    Basic Variables Definitions
  ============================================================================*/
$fileAllowedSize = get_conf('max_file_size_per_works');
//file size in bytes (from config file)
$maxFilledSpace = get_conf('maxFilledSpace', 100000000);
// initialise dialog box to an empty string, all dialog will be concat to it
$dialogBox = new DialogBox();
/*============================================================================
    Clean informations sent by user
  ============================================================================*/
unset($req);
$acceptedCmdList = array('rqDownload', 'exDownload');
if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) {
    $cmd = $_REQUEST['cmd'];
} else {
    $cmd = null;
}
if (isset($_REQUEST['downloadMode'])) {
    $downloadMode = $_REQUEST['downloadMode'];
} else {
    $downloadMode = 'all';
}
Exemplo n.º 26
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object LiveValidation
  * @since 1.0.35
  */
 public function render($ajax_render = false)
 {
     if (!isset($this->object)) {
         throw new NewException("1 argument for " . get_class($this) . "::__construct() is mandatory", 0, getDebugBacktrace(1));
     }
     if (get_class($this->object) == "Form") {
         return;
     }
     $html = $this->getJavascriptTagOpen();
     if (get_class($this->object) == "Editor") {
         $id = $this->object->getHiddenId();
     } else {
         $id = $this->object->getId();
     }
     $html .= "\tLV_" . $id . " = new LiveValidation('" . $id . "'";
     if ($this->onlyOnSubmit) {
         $html .= ", {onlyOnSubmit: true}";
     }
     $html .= ");\n";
     $html .= "\tLV_" . $id . $this->validate_js . ";\n";
     if ($this->valid_init) {
         $html .= "\tLV_" . $id . ".validate();\n";
     }
     if (method_exists($this->object, "getFormObject")) {
         $form_object = $this->object->getFormObject();
         if ($form_object != null) {
             // search all button of the form
             $event_object_name = "Button_" . $form_object->getName();
             $eventObject = $form_object->getPageObject()->getEventObjects($event_object_name);
             for ($i = 0; $i < sizeof($eventObject); $i++) {
                 if (find($eventObject[$i]->getOnClickJs(), "/*LV_condition_zone*/", 0, 0) > 0) {
                     $eventObject[$i]->onClickJs(str_replace("/*LV_validate_zone*/", "LV_" . $id . ".validate();/*LV_validate_zone*/", $eventObject[$i]->getOnClickJs()));
                     $eventObject[$i]->onClickJs(str_replace("/*LV_condition_zone*/", "&&LiveValidationForm_" . $form_object->getName() . "_" . $id . "()/*LV_condition_zone*/", $eventObject[$i]->getOnClickJs()));
                 } else {
                     $html .= "\tlv_error_alert_id = '';\n\tlv_error_alert_field_name = '';\n\tlv_error_alert_msg = '';\n\tLV_ErrorAlert_" . $form_object->getName() . " = function() { ";
                     $error_dialogbox_msg = new DialogBox(__(ERROR), __(LIVE_VALIDATION_FORMULAR_ERROR_MSG));
                     $error_dialogbox_msg->activateCloseButton("\$('#'+lv_error_alert_id).focus();");
                     $error_dialogbox_field = new DialogBox(__(ERROR), __(LIVE_VALIDATION_FORMULAR_FIELD_ERROR));
                     $error_dialogbox_field->activateCloseButton("\$('#'+lv_error_alert_id).focus();");
                     if (DEBUG) {
                         $error_dialogbox = new DialogBox(__(ERROR), __(LIVE_VALIDATION_FORMULAR_ERROR_DEBUG));
                     } else {
                         $error_dialogbox = new DialogBox(__(ERROR), __(LIVE_VALIDATION_FORMULAR_ERROR));
                     }
                     $error_dialogbox->activateCloseButton();
                     $html .= "\tif (lv_error_alert_msg != '') {\n";
                     $html .= "\t\t" . $error_dialogbox_msg->render() . "\n";
                     $html .= "\t} else if (lv_error_alert_field_name != '') {\n";
                     $html .= "\t\t" . $error_dialogbox_field->render();
                     $html .= "\t} else {\n";
                     $html .= "\t\t" . $error_dialogbox->render() . "\n";
                     $html .= "\t}\n";
                     $html .= " };\n";
                     $eventObject[$i]->onClickJs("LV_" . $id . ".validate();/*LV_validate_zone*/if(LiveValidationForm_" . $form_object->getName() . "_" . $id . "()/*LV_condition_zone*/){" . $eventObject[$i]->getOnClickJs() . "}else{LV_ErrorAlert_" . $form_object->getName() . "();return false;}");
                 }
             }
             $html .= "\tLiveValidationForm_" . $form_object->getName() . "_" . $id . " = function() {\n";
             $html .= "\t\tif (\$('#" . $id . "').attr('disabled')) {\n";
             $html .= "\t\t\treturn true;\n";
             $html .= "\t\t} else {\n";
             $html .= "\t\t\tvar valid=(LV_" . $id . ".message!='Thankyou!'||LV_" . $id . ".message==null)?false:true;\n";
             $html .= "\t\t\tif (valid) return true;\n";
             $html .= "\t\t\tlv_error_alert_id = '" . $id . "';\n";
             if ($this->field_name != "") {
                 $html .= "\t\t\tlv_error_alert_field_name = '" . addslashes($this->field_name) . "';\n";
             } else {
                 $html .= "\t\t\tlv_error_alert_field_name = '';\n";
             }
             if ($this->alert_msg != "") {
                 $html .= "\t\t\tlv_error_alert_msg = '" . addslashes($this->alert_msg) . "';\n";
             } else {
                 $html .= "\t\t\tlv_error_alert_msg = '';\n";
             }
             $html .= "\t\t\treturn false;\n";
             $html .= "\t\t}\n";
             $html .= "\t};\n";
         } else {
             throw new NewException("To use LineValidation for object " . get_class($this->object) . " you must add him in a form (form object is null).", 0, getDebugBacktrace(1));
         }
     } else {
         throw new NewException("LineValidation error: method getFormObject is missing for object " . get_class($this->object) . ".", 0, getDebugBacktrace(1));
     }
     $html .= $this->getJavascriptTagClose();
     $this->object_change = false;
     return $html;
 }
Exemplo n.º 27
0
require_once 'language.lib.php';
require_once get_path('includePath') . "/lib/pager.lib.php";
// table
$tbl_used_lang = '`' . $mainDbName . '`.`' . $mainTblPrefix . TABLE_USED_LANG_VAR . '`';
$tbl_translation = '`' . $mainDbName . '`.`' . $mainTblPrefix . TABLE_TRANSLATION . '`';
// get start time
$starttime = get_time();
// pager params
$resultPerPage = 50;
if (isset($_REQUEST['offset'])) {
    $offset = $_REQUEST['offset'];
} else {
    $offset = 0;
}
// start content
$dialogBox = new DialogBox();
$nameTools = 'Display different variables with the same content';
$urlSDK = $rootAdminWeb . 'xtra/sdk/';
$urlTranslation = $urlSDK . 'translation_index.php';
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Translation Tools'), $urlTranslation);
ClaroBreadCrumbs::getInstance()->prepend(get_lang('SDK'), $urlSDK);
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
include $includePath . "/claro_init_header.inc.php";
echo claro_html_tool_title($nameTools);
$dialogBox->title('Change language');
// start form
$form = "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"GET\">";
if (isset($_REQUEST['language'])) {
    $language = $_REQUEST['language'];
} else {
    $language = DEFAULT_LANGUAGE;
Exemplo n.º 28
0
            if (!class_exists($portlet['label'])) {
                pushClaroMessage("User desktop : class {$portlet['label']} not found !", 'warning');
                continue;
            }
            if ($portlet['label'] == 'mycourselist') {
                continue;
            }
            $plabel = $portlet['label'];
            $portlet = new $plabel($plabel);
            if (!$portlet instanceof UserDesktopPortlet) {
                pushClaroMessage("{$portlet['label']} is not a valid user desktop portlet !");
                continue;
            }
            $outPortlet .= $portlet->render();
        } catch (Exception $e) {
            $portletDialog = new DialogBox();
            $portletDialog->error(get_lang('An error occured while loading the portlet : %error%', array('%error%' => $e->getMessage())));
            $outPortlet .= '<div class="claroBlock portlet">' . '<h3 class="blockHeader">' . "\n" . $portlet->renderTitle() . '</h3>' . "\n" . '<div class="claroBlockContent">' . "\n" . $portletDialog->render() . '</div>' . "\n" . '</div>' . "\n\n";
        }
    }
} else {
    $dialogBox->error(get_lang('Cannot load portlet list'));
}
// Generate Script Output
CssLoader::getInstance()->load('desktop', 'all');
$template = new CoreTemplate('user_desktop.tpl.php');
$userProfileBox = new UserProfileBox(false);
$myCourseList = new MyCourseList();
$template->assign('dialogBox', $dialogBox);
$template->assign('userProfileBox', $userProfileBox);
$template->assign('outPortlet', $outPortlet);
Exemplo n.º 29
0
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @see         http://www.claroline.net/wiki/Auth/
 * @author      Claro Team <*****@*****.**>
 * @package     AUTH
 */
/*=====================================================================
Init Section
=====================================================================*/
$cidReset = true;
$gidReset = true;
$uidRequired = true;
require '../inc/claro_init_global.inc.php';
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
$dialogBox = new DialogBox();
$display = '';
$error = false;
// include configuration files
include claro_get_conf_repository() . 'user_profile.conf.php';
// find this file to modify values.
// include library files
include_once get_path('incRepositorySys') . '/lib/user.lib.php';
include_once get_path('incRepositorySys') . '/lib/sendmail.lib.php';
include_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
include_once get_path('incRepositorySys') . '/lib/fileUpload.lib.php';
include_once get_path('incRepositorySys') . '/lib/image.lib.php';
include_once get_path('incRepositorySys') . '/lib/display/dialogBox.lib.php';
$nameTools = get_lang('My user account');
// define display
define('DISP_PROFILE_FORM', __LINE__);
Exemplo n.º 30
0
 /**
  * Method render
  * @access public
  * @param boolean $ajax_render [default value: false]
  * @return string html code of object DraggableEvent
  * @since 1.0.35
  */
 public function render($ajax_render = false)
 {
     if (DialogBox::getCurrentDialogBoxLevel() > -1) {
         $this->ondragstart = "wspDialogBox" . DialogBox::getCurrentDialogBoxLevel() . ".dialog('widget').css('overflow', 'visible'); wspDialogBox" . DialogBox::getCurrentDialogBoxLevel() . ".dialog('widget').find('.ui-dialog-content').css('overflow', 'visible');" . $this->ondragstart;
         $this->ondragend = "wspDialogBox" . DialogBox::getCurrentDialogBoxLevel() . ".dialog('widget').css('overflow', 'hidden'); wspDialogBox" . DialogBox::getCurrentDialogBoxLevel() . ".dialog('widget').find('.ui-dialog-content').css('overflow', 'hidden');" . $this->ondragend;
     } else {
         if (isset($_GET['tabs_object_id'])) {
             $this->ondragstart = "\$('#" . $_GET['tabs_object_id'] . "').tabs().css('overflow', 'visible');\$('#" . $_GET['tabs_object_id'] . "').tabs().find('.ui-widget-content').css('overflow', 'visible');" . $this->ondragstart;
             $this->ondragend = "\$('#" . $_GET['tabs_object_id'] . "').tabs().css('overflow', 'hidden');\$('#" . $_GET['tabs_object_id'] . "').tabs().find('.ui-widget-content').css('overflow', 'hidden');" . $this->ondragend;
         } else {
             $this->ondragstart = "\$('.BoxOverFlowHidden').css('overflow', 'auto');" . $this->ondragstart;
             $this->ondragend = "\$('.BoxOverFlowHidden').css('overflow', 'hidden');" . $this->ondragend;
         }
     }
     if ($this->ondragstart != "") {
         $this->page_object->addObject(new JavaScript("\$('#" . $this->draggable_id . "').bind('dragstart', function(event, ui) { " . $this->ondragstart . " });"));
     }
     if ($this->ondragend != "") {
         $this->page_object->addObject(new JavaScript("\$('#" . $this->draggable_id . "').bind('dragstop', function(event, ui) { " . $this->ondragend . " });"));
     }
     $this->object_change = false;
     return "";
 }