Example #1
0
 /**
  * Display a standart pager tool bar
  *
  * @author Hugues Peeters <*****@*****.**>
  * @param  string $url - where the pager tool bar commands need to point to
  * @param  int $linkMax - (optionnal) maximum of page links in the pager tool bar
  * @return string
  */
 function disp_pager_tool_bar($url, $linkMax = 10)
 {
     $startPage = $this->get_first_offset();
     $previousPage = $this->get_previous_offset();
     $pageList = $this->get_offset_list();
     $nextPage = $this->get_next_offset();
     $endPage = $this->get_last_offset();
     if (strrpos($url, '?') === false) {
         $url .= '?' . $this->pagerParamName . '=';
     } else {
         $url .= '&amp;' . $this->pagerParamName . '=';
     }
     $output = "\n\n" . '<div class="claroPager">' . "\n" . '<span class="pagerBefore">' . "\n";
     if ($previousPage !== false) {
         $output .= '<b>' . '<a href="' . $url . $startPage . '">' . claro_html_icon('pager_first') . '</a>&nbsp;' . '<a href="' . $url . $previousPage . '">' . claro_html_icon('pager_previous') . '</a>' . '</b>';
     } else {
         $output .= '&nbsp;';
     }
     $output .= "\n" . '</span>' . "\n" . '<span class="pagerPages">' . "\n";
     // current page
     $currentPage = (int) $this->offset / $this->step;
     // total page
     $pageCount = $this->get_offset_count();
     // start page
     if ($currentPage > $linkMax) {
         $firstLink = $currentPage - $linkMax;
     } else {
         $firstLink = 0;
     }
     // end page
     if ($currentPage + $linkMax < $pageCount) {
         $lastLink = $currentPage + $linkMax;
     } else {
         $lastLink = $pageCount;
     }
     // display 1 ... {start_page}
     if ($firstLink > 0) {
         $output .= '<a href="' . $url . $pageList[0] . '">' . (0 + 1) . '</a>&nbsp;';
         if ($firstLink > 1) {
             $output .= '...&nbsp;';
         }
     }
     if ($pageCount > 1) {
         // display page
         for ($link = $firstLink; $link < $lastLink; $link++) {
             if ($currentPage == $link) {
                 $output .= '<b>' . ($link + 1) . '</b> ';
                 // current page
             } else {
                 $output .= '<a href="' . $url . $pageList[$link] . '">' . ($link + 1) . '</a> ';
             }
         }
     }
     // display 1 ... {start_page}
     if ($lastLink < $pageCount) {
         if ($lastLink + 1 < $pageCount) {
             $output .= '...';
         }
         $output .= '&nbsp;<a href="' . $url . $pageList[$pageCount - 1] . '">' . $pageCount . '</a>';
     }
     $output .= "\n" . '</span>' . "\n" . '<span class="pagerAfter">' . "\n";
     if ($nextPage !== false) {
         $output .= '<b>' . '<a href="' . $url . $nextPage . '">' . claro_html_icon('pager_next') . '</a>&nbsp;' . '<a href="' . $url . $endPage . '">' . claro_html_icon('pager_last') . '</a>' . '</b>';
     } else {
         $output .= '&nbsp;';
     }
     $output .= "\n" . '</span>' . "\n" . '</div>' . "\n\n";
     return $output;
 }
Example #2
0
$nameTools = get_lang('Manage user desktop');
$output = '';
$output .= claro_html_tool_title($nameTools);
$output .= $dialogBox->render();
$output .= '<table class="claroTable emphaseLine" ' . 'width="100%" border="0" cellspacing="2">' . "\n" . '<thead>' . "\n" . '<tr align="center" valign="top">' . "\n" . '<th>' . get_lang('Title') . '</th>' . "\n" . '<th>' . get_lang('Visibility') . '</th>' . "\n" . '<th colspan="2">' . get_lang('Order') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>' . "\n";
if (is_array($portletList) && !empty($portletList)) {
    // only used to hide first up and last down commands
    $portletListSize = count($portletList);
    $i = 0;
    foreach ($portletList as $portlet) {
        $i++;
        $output .= "\n" . '<tr>' . "\n" . '<td>' . claro_htmlspecialchars(get_lang($portlet['name'])) . '</td>' . "\n";
        if ($portlet['visibility'] == 'visible') {
            $output .= "\n" . '<td align="center">' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exInvisible&amp;label=' . claro_htmlspecialchars($portlet['label']))) . '">' . claro_html_icon('visible') . '</a>' . "\n" . '</td>' . "\n";
        } else {
            $output .= "\n" . '<td align="center">' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exVisible&amp;label=' . claro_htmlspecialchars($portlet['label']))) . '">' . claro_html_icon('invisible') . '</a>' . "\n" . '</td>' . "\n";
        }
        if ($i > 1) {
            $output .= '<td align="center">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?label=' . claro_htmlspecialchars($portlet['label']) . '&amp;cmd=exUp')) . '">' . '<img src="' . get_icon_url('move_up') . '" alt="' . get_lang('Move up') . '" />' . '</a>' . '</td>' . "\n";
        } else {
            $output .= '<td>&nbsp;</td>' . "\n";
        }
        if ($i < $portletListSize) {
            $output .= '<td align="center">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?label=' . claro_htmlspecialchars($portlet['label']) . '&amp;cmd=exDown')) . '">' . '<img src="' . get_icon_url('move_down') . '" alt="' . get_lang('Move down') . '" />' . '</a>' . '</td>' . "\n";
        } else {
            $output .= '<td>&nbsp;</td>' . "\n";
        }
        $output .= '</tr>' . "\n";
    }
} else {
    $output .= '<tr><td colspan="4">' . get_lang('Empty') . '</tr></td>' . "\n";
Example #3
0
/**
 * Add a claroCmd button with icon to HTML output
 * @param string targetUrl url of the target page
 * @param string iconName name of the icon with or without file extension
 *      (optional, default none)
 * @param string buttonText text of the button
 *      (optional, default none)
 * @param string toolTip tooltip of the button
 *      (optional, default none)
 */
function claro_html_icon_button($targetUrl, $iconName = '', $buttonText = '', $toolTip = '')
{
    return '<a class="claroCmd"' . "\n" . ' href="' . $targetUrl . '"' . ($toolTip ? "\n" . ' title="' . claro_htmlspecialchars($toolTip) . '"' : '') . '>' . "\n" . ($iconName ? claro_html_icon($iconName) . "\n" : '') . ($buttonText ? claro_htmlspecialchars($buttonText) . "\n" : '') . '</a>';
}
Example #4
0
 /**
  * Render a link to register.
  */
 private function renderRegistrationLink()
 {
     return '<a href="' . claro_htmlspecialchars(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id()) . '">' . claro_html_icon('enroll') . ' ' . '<b>' . get_lang('Enrolment') . '</b>' . '</a>';
 }
Example #5
0
 public function render()
 {
     $nodeHtml = '';
     if (!empty($this->url)) {
         $nodeHtml .= '<a href="' . $this->url . '"  target="_top">';
     }
     if (!empty($this->icon)) {
         $nodeHtml .= claro_html_icon('home', null, null) . '&nbsp;';
     }
     $nodeHtml .= $this->name;
     if (!empty($this->url)) {
         $nodeHtml .= '</a>';
     }
     return $nodeHtml;
 }
Example #6
0
if (!claro_is_platform_admin()) {
    $courseStatus = claro_get_current_course_data('status');
    if ($courseStatus == 'trash' || $courseStatus == 'disable') {
        Claroline::getDisplay()->body->hideCourseTitleAndTools();
        claro_die(get_lang('This course is not available anymore, please contact the platform administrator.'));
    }
}
// post kernel access check
if (claro_is_in_a_course()) {
    if (!(basename(php_self()) == 'courses.php' && isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'exReg')) {
        if (!claro_is_course_allowed()) {
            if (!claro_is_user_authenticated()) {
                claro_disp_auth_form();
            } else {
                if (claro_get_current_course_data('access') == 'private' && !claro_is_course_member()) {
                    claro_die(get_lang("You have to be enroled to this course to access its contents") . '<br /><a href="' . claro_htmlspecialchars(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id()) . '">' . claro_html_icon('enroll') . ' ' . '<b>' . get_lang('Enrolment') . '</b>' . '</a>');
                } else {
                    claro_die(get_lang("Not allowed!"));
                }
            }
        }
    }
}
// group_space.php?registration=1&selfReg=1
if (claro_is_in_a_group()) {
    if (!(basename(php_self()) == 'group_space.php' && isset($_REQUEST['registration']) && $_REQUEST['registration'] == '1')) {
        if (!claro_is_group_allowed()) {
            if (!claro_is_user_authenticated()) {
                claro_disp_auth_form();
            } else {
                claro_die(get_lang("Not allowed!"));