function botVoting(&$row, &$params, $page = 0) { global $Itemid, $task; $id = $row->id; $option = 'com_content'; $html = ''; if ($params->get('rating') && !$params->get('popup')) { $html .= '<form method="post" action="' . sefRelToAbs('index.php') . '">'; $img = ''; // look for images in template if available $starImageOn = mosAdminMenus::ImageCheck('rating_star.png', '/images/M_images/'); $starImageOff = mosAdminMenus::ImageCheck('rating_star_blank.png', '/images/M_images/'); for ($i = 0; $i < $row->rating; $i++) { $img .= $starImageOn; } for ($i = $row->rating; $i < 5; $i++) { $img .= $starImageOff; } $html .= '<span class="content_rating">'; $html .= _USER_RATING . ':' . $img . ' / '; $html .= intval($row->rating_count); $html .= "</span>\n<br />\n"; $url = @$_SERVER['REQUEST_URI']; $url = ampReplace($url); if (!$params->get('intro_only') && $task != "blogsection") { $html .= '<span class="content_vote">'; $html .= _VOTE_POOR; $html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />'; $html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />'; $html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />'; $html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />'; $html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />'; $html .= _VOTE_BEST; $html .= ' <input class="button" type="submit" name="submit_vote" value="' . _RATE_BUTTON . '" />'; $html .= '<input type="hidden" name="task" value="vote" />'; $html .= '<input type="hidden" name="pop" value="0" />'; $html .= '<input type="hidden" name="option" value="com_content" />'; $html .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $html .= '<input type="hidden" name="cid" value="' . $id . '" />'; $html .= '<input type="hidden" name="url" value="' . $url . '" />'; $html .= '</span>'; } $html .= '</form>'; } return $html; }
/** * Saves the content item an edit form submit */ function saveContent(&$access, $task) { global $database, $mainframe, $my; global $mosConfig_absolute_path, $mosConfig_offset, $Itemid; // simple spoof check security josSpoofCheck(); $nullDate = $database->getNullDate(); $row = new mosContent($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // sanitise id field $row->id = (int) $row->id; $isNew = $row->id < 1; if ($isNew) { // new record if (!($access->canEdit || $access->canEditOwn)) { mosNotAuth(); return; } $row->created = date('Y-m-d H:i:s'); $row->created_by = $my->id; } else { // existing record if (!($access->canEdit || $access->canEditOwn && $row->created_by == $my->id)) { mosNotAuth(); return; } $row->modified = date('Y-m-d H:i:s'); $row->modified_by = $my->id; } if (strlen(trim($row->publish_up)) <= 10) { $row->publish_up .= ' 00:00:00'; } $row->publish_up = mosFormatDate($row->publish_up, _CURRENT_SERVER_TIME_FORMAT, -$mosConfig_offset); if (trim($row->publish_down) == 'Never' || trim($row->publish_down) == '') { $row->publish_down = $nullDate; } else { if (strlen(trim($row->publish_down)) <= 10) { $row->publish_down .= ' 00:00:00'; } $row->publish_down = mosFormatDate($row->publish_down, _CURRENT_SERVER_TIME_FORMAT, -$mosConfig_offset); } // code cleaner for xhtml transitional compliance $row->introtext = str_replace('<br>', '<br />', $row->introtext); $row->fulltext = str_replace('<br>', '<br />', $row->fulltext); // remove <br /> take being automatically added to empty fulltext $length = strlen($row->fulltext) < 9; $search = strstr($row->fulltext, '<br />'); if ($length && $search) { $row->fulltext = NULL; } $row->title = ampReplace($row->title); // Publishing state hardening for Authors if (!$access->canPublish) { if ($isNew) { // For new items - author is not allowed to publish - prevent them from doing so $row->state = 0; } else { // For existing items keep existing state - author is not allowed to change status $query = "SELECT state" . "\n FROM #__content" . "\n WHERE id = " . (int) $row->id; $database->setQuery($query); $state = $database->loadResult(); if ($state) { $row->state = 1; } else { $row->state = 0; } } } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->version++; if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // manage frontpage items require_once $mainframe->getPath('class', 'com_frontpage'); $fp = new mosFrontPage($database); if (intval(mosGetParam($_REQUEST, 'frontpage', 0))) { // toggles go to first place if (!$fp->load((int) $row->id)) { // new entry $query = "INSERT INTO #__content_frontpage" . "\n VALUES ( " . (int) $row->id . ", 1 )"; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->stderr() . "');</script>\n"; exit; } $fp->ordering = 1; } } else { // no frontpage mask if (!$fp->delete((int) $row->id)) { $msg .= $fp->stderr(); } $fp->ordering = 0; } $fp->updateOrder(); $row->checkin(); $row->updateOrder("catid = " . (int) $row->catid); // gets section name of item $query = "SELECT s.title" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND s.id = " . (int) $row->sectionid; $database->setQuery($query); // gets category name of item $section = $database->loadResult(); $query = "SELECT c.title" . "\n FROM #__categories AS c" . "\n WHERE c.id = " . (int) $row->catid; $database->setQuery($query); $category = $database->loadResult(); $category = stripslashes($category); if ($isNew) { // messaging for new items require_once $mosConfig_absolute_path . '/components/com_messages/messages.class.php'; $query = "SELECT id" . "\n FROM #__users" . "\n WHERE sendEmail = 1"; $database->setQuery($query); $users = $database->loadResultArray(); foreach ($users as $user_id) { $msg = new mosMessage($database); $msg->send($my->id, $user_id, "New Item", sprintf(_ON_NEW_CONTENT, $my->username, $row->title, $section, $category)); } } $msg = $isNew ? _THANK_SUB : _E_ITEM_SAVED; $msg = $my->usertype == 'Publisher' ? _THANK_SUB_PUB : $msg; switch ($task) { case 'apply': $link = $_SERVER['HTTP_REFERER']; break; case 'apply_new': $Itemid = intval(mosGetParam($_POST, 'Returnid', $Itemid)); $link = 'index.php?option=com_content&task=edit&id=' . $row->id . '&Itemid=' . $Itemid; break; case 'save': default: $Itemid = mosGetParam($_POST, 'Returnid', ''); if ($Itemid) { if ($access->canEdit) { $link = 'index.php?option=com_content&task=view&id=' . $row->id . '&Itemid=' . $Itemid; } else { $link = 'index.php'; } } else { $link = strval(mosGetParam($_POST, 'referer', '')); } break; } mosRedirect($link, $msg); }
function menuLink($option, $id) { global $database; josSpoofCheck(); $menu = strval(mosGetParam($_POST, 'menuselect', '')); $link = strval(mosGetParam($_POST, 'link_name', '')); $link = stripslashes(ampReplace($link)); $row = new mosMenu($database); $row->menutype = $menu; $row->name = $link; $row->type = 'content_typed'; $row->published = 1; $row->componentid = $id; $row->link = 'index.php?option=com_content&task=view&id=' . $id; $row->ordering = 9999; if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype=" . $database->Quote($row->menutype) . " AND parent=" . (int) $row->parent); // clean any existing cache files mosCache::cleanCache('com_content'); $msg = $link . ' (Link - Static Content) in menu: ' . $menu . ' successfully created'; mosRedirect('index2.php?option=' . $option . '&task=edit&hidemainmenu=1&id=' . $id, $msg); }
function JLMS_showTopMenu($id, $option, $with_back = false, $back_link = '', $help_task = '', $gqp = false) { global $my, $Itemid, $JLMS_SESSION, $JLMS_CONFIG, $JLMS_LANGUAGE; $back_status = $JLMS_SESSION->has('jlms_section') ? $JLMS_SESSION->get('jlms_section') : ' '; //$back_status = $gqp?(_JLMS_TOOLBAR_GQP_PARENT):$back_status; if (!$help_task) { $help_task = $JLMS_SESSION->get('jlms_task'); } $user_access = $JLMS_CONFIG->get('current_usertype'); if ($user_access == 2) { $help_task = "stu_" . $help_task; } elseif ($user_access == 6) { $help_task = "ceo_" . $help_task; } $menus = $JLMS_CONFIG->get('jlms_menu'); JLMS_require_lang($JLMS_LANGUAGE, 'main.lang', $JLMS_CONFIG->get('default_language')); if ($JLMS_CONFIG->get('lofe_show_course_box', true) && $JLMS_CONFIG->get('lofe_box_type', 1) || $JLMS_CONFIG->get('lofe_show_head', true) && $JLMS_CONFIG->get('lofe_show_top', true)) { ?> <script language="JavaScript" type="text/javascript"> <!--//--><![CDATA[//><!-- <?php $add_js = ''; if ($JLMS_CONFIG->get('lofe_show_head', true) && $JLMS_CONFIG->get('lofe_show_top', true)) { $add_js = "\n\t\t\tfunction jlms_ShowTBToolTip(txt_tooltip) {\n\t\t\t\t\t\$('JLMS_toolbar_tooltip').innerHTML = txt_tooltip;\n\t\t\t}\n\t\t"; } if ($JLMS_CONFIG->get('lofe_show_course_box', true) && $JLMS_CONFIG->get('lofe_box_type', 1)) { $add_js .= "\n\t\t\tfunction jlms_redirect(redirect_url) {\n\t\t\t\ttop.location.href = redirect_url;\n\t\t\t}\n\t\t\tfunction jlms_tr_over(td) {\n\t\t\t\ttd.style['background'] = '#FFFFFF';\t\t\t\n\t\t\t}\n\t\t\tfunction jlms_tr_out(td) {\n\t\t\t\ttd.style['background'] = '#EEEEEE';\t\t\t\n\t\t\t}\n\t\t\tJLMS_preloadImages('" . $JLMS_CONFIG->getCfg('live_site') . "/components/com_joomla_lms/lms_images/front_menu/menu_bg3.png');\n\t\t\t"; } if ($add_js) { $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $add_js); } ?> //--><!]]> </script> <?php } if ($JLMS_CONFIG->get('lofe_show_top', true) || $JLMS_CONFIG->get('lofe_show_course_box', true)) { ?> <table cellpadding="0" cellspacing="0" border="0" align="right" class="jlms_top_menu_outer"> <?php if ($JLMS_CONFIG->get('lofe_show_head', true) && $JLMS_CONFIG->get('lofe_show_top', true)) { ?> <tr><td align="center" style="text-align:center "> <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="jlms_top_menu_tooltips"> <tr> <td align="center" width="100%" style="text-align:center "> <span id="JLMS_toolbar_tooltip"><?php echo $back_status; ?> </span> </td> <?php //if ($JLMS_CONFIG->get('current_usertype') == 1) { /*if (false) { ?> <td align="right" nowrap="nowrap" style="white-space:nowrap "> <?php $u = JLMS_getOnlineUsers( $id );?> <a href="<?php echo sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=online_users&course_id=$id");?>"><?php echo (_JLMS_ONLINE_USERS.' '.count($u));?></a> </td> <?php }*/ ?> </tr> </table> </td></tr> <?php } if ($JLMS_CONFIG->get('lofe_show_top', true)) { ?> <tr><td nowrap="nowrap" style="white-space:nowrap; text-align:right " align="right"> <?php $script = 0; $imh = '16'; //$JLMS_CONFIG->get('top_menu_type'); $imp = 'toolbar'; if (!$JLMS_CONFIG->get('lofe_menu_style', 1)) { $imp = 'toolbar'; $imh = '16'; } elseif ($JLMS_CONFIG->get('lofe_menu_style', 1) == 1) { $imp = 'toolbar_24'; $imh = '24'; } elseif ($JLMS_CONFIG->get('lofe_menu_style', 1) == 2) { $imp = 'toolbar_32'; $imh = '32'; } /*if ($imh == 32) { $imp = 'toolbar_32'; } elseif ($imh == 22) { $imp = 'toolbar_22'; } elseif ($imh == 24) { $imp = 'toolbar_24'; }*/ $help_link = $JLMS_CONFIG->get('jlms_help_link', "http://www.joomlalms.com/index.php?option=com_lms_help&Itemid=40&task=view_by_task&key={toolname}"); $was_separator = false; $JLMS_ACL =& JLMSFactory::getACL(); // echo '<pre>'; // print_r($menus); // echo '</pre>'; foreach ($menus as $menu) { $disabled = 0; if (isset($menu->disabled) && $menu->disabled) { } else { $is_shown = true; if ($menu->is_separator) { if (!$was_separator) { echo '<img src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/spacer.png" border="0" width="2" height="' . $imh . '" style="background-color:#666666 " alt=" " />'; } $was_separator = true; } else { if ($menu->task == 'view_all_notices' && !$JLMS_CONFIG->get('flms_integration', 0)) { } else { // check user permissions (14.09.2008 - DEN) /*if (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_DOCS') { $is_shown = $JLMS_ACL->CheckToolPermissions('docs'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_QUIZZES') { $is_shown = $JLMS_ACL->CheckToolPermissions('quizzes'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_LINKS') { $is_shown = $JLMS_ACL->CheckToolPermissions('links'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_LPATH') { $is_shown = $JLMS_ACL->CheckToolPermissions('lpaths'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_AGENDA') { $is_shown = $JLMS_ACL->CheckToolPermissions('announce'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_ATTEND') { $is_shown = $JLMS_ACL->CheckToolPermissions('attendance'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_CHAT') { $is_shown = $JLMS_ACL->CheckToolPermissions('chat'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_CONF') { $is_shown = $JLMS_ACL->CheckToolPermissions('conference'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_GRADEBOOK') { $is_shown = $JLMS_ACL->CheckToolPermissions('gradebook'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_TRACK') { $is_shown = $JLMS_ACL->CheckToolPermissions('tracking'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_MAILBOX') { $is_shown = $JLMS_ACL->CheckToolPermissions('mailbox'); } elseif (isset($menu->lang_var) && $menu->lang_var == '_JLMS_TOOLBAR_USERS') { $is_shown = $JLMS_ACL->CheckToolPermissions('users'); } elseif (isset($menu->user_options) && $menu->user_options) { $is_shown = $JLMS_ACL->CheckToolPermissions('user_settings'); }*/ if ($is_shown) { $was_separator = false; if (isset($menu->help_task) && $menu->help_task) { $help_link = ampReplace(str_replace('{toolname}', $help_task, $help_link)); $menu->menulink = $help_link; } if (isset($menu->user_options) && $menu->user_options) { } else { $lang_var_menu = ''; if ($menu->lang_var && defined($menu->lang_var)) { $lang_var_menu = constant($menu->lang_var); } elseif (isset($JLMS_LANGUAGE[$menu->lang_var]) && $JLMS_LANGUAGE[$menu->lang_var]) { $lang_var_menu = $JLMS_LANGUAGE[$menu->lang_var]; } $add = ''; if ($JLMS_CONFIG->get('lofe_show_head', true)) { $add = "onmouseover='javascript:jlms_ShowTBToolTip(\"" . $lang_var_menu . "\");jlms_WStatus(\"" . $lang_var_menu . "\");return true;' " . $menu->target . " onmouseout='javascript:jlms_ShowTBToolTip(\"" . $back_status . "\");jlms_WStatus(\"\");return true;'"; } ?> <a <?php echo $add; ?> class="jlms_menu_control" href="<?php echo $menu->menulink; ?> " title="<?php echo $lang_var_menu; ?> "><img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/<?php echo $imp . "/" . $menu->image; ?> " border="0" width="<?php echo $imh; ?> " height="<?php echo $imh; ?> " alt="<?php echo $lang_var_menu; ?> " title="<?php echo $lang_var_menu; ?> " /></a> <?php } } } } if (isset($menu->user_options) && $menu->user_options && $is_shown) { $script = 1; $add = ''; if ($JLMS_CONFIG->get('lofe_show_head', true)) { $add = " onmouseover='javascript:jlms_ShowTBToolTip(\"" . _JLMS_TOOLBAR_USER_OPTIONS . "\");jlms_WStatus(\"" . _JLMS_TOOLBAR_USER_OPTIONS . "\");return true;' onmouseout='javascript:jlms_ShowTBToolTip(\"" . $back_status . "\");jlms_WStatus(\"\");return true;'"; } ?> <a id="jlms_plugins_run"<?php echo $add; ?> class="jlms_menu_control" href="javascript:void(0);" title="<?php echo _JLMS_TOOLBAR_TO_TEACH; ?> "><img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/<?php echo $imp . "/" . $menu->image; ?> " border="0" width="<?php echo $imh; ?> " height="<?php echo $imh; ?> " alt="<?php echo _JLMS_TOOLBAR_USER_OPTIONS; ?> " title="<?php echo _JLMS_TOOLBAR_USER_OPTIONS; ?> " /></a> <?php } } } echo "<br />"; echo "</td></tr>"; } if (!$gqp) { if ($JLMS_CONFIG->get('lofe_show_course_box', true)) { $cid = $JLMS_CONFIG->get('teacher_in_courses', array()); $cid = array_merge($cid, $JLMS_CONFIG->get('student_in_courses', array())); $cid = array_merge($cid, $JLMS_CONFIG->get('parent_in_courses', array())); $cid = array_unique($cid); $courses = JLMS_CoursesNames($cid); $cur_course = 'undefined'; foreach ($courses as $course) { if ($id == $course->id) { $cur_course = $course->course_name; } //substr($course->course_name,0,15);} } ?> <tr> <td align="right" style="text-align:right "> <?php if (false) { ?> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td align="right" nowrap="nowrap" style="text-align:right; font-size:10px; line-height:1.5"> <?php echo _JLMS_CURRENT_COURSE; ?> </td> <td width="120"> <table width="120" cellpadding="0" cellspacing="0" border="0" align="right"> <tr> <td colspan="2" align="left" style="text-align:left; background:url(<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/front_menu/menu_bg.png) no-repeat; "> <table style="cursor:pointer; border-bottom:1px solid #666666; width:220px;" id="demo1run1" width="220" cellpadding="0" cellspacing="0" border="0"><tr><td align="left"> <div style="cursor:pointer; overflow:hidden; white-space:nowrap; width:200px;" > <?php echo $cur_course; ?> </div> </td><td align="right" width="20"><img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/course_select_arrow.png" alt="select_arrow" title="select_arrow" border="0" width="10" height="10" /> </td></tr></table> <div align="right" id="course_menu_cont" style="position: absolute; visibility: hidden; width: 220px; font-size:10px; line-height:1.5"> <div> <div id="demo1"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_top_menu_items_table" id="jlms_top_menu_items_table_id"> <?php $i = 0; foreach ($courses as $course) { $link = ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=" . $JLMS_SESSION->get('jlms_task') . "&id={$course->id}")); echo "<tr id='cmenu_" . $i . "' onmouseover=\"jlms_tr_over(this);\" onmouseout=\"jlms_tr_out(this);\" onclick=\"jlms_redirect('" . $link . "');\"><td align='left'><div> " . ($id == $course->id ? '<b>' . $course->course_name . '</b>' : $course->course_name) . "</div></td></tr>"; $i++; } ?> <tr style='cursor:pointer; background:url(<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/front_menu/menu_bg2.png) no-repeat; background-position: bottom;'><td style="height:4px; border:0px"></td></tr> </table> </div> </div> <?php if ($JLMS_CONFIG->get('web20_effects', true)) { $domready = ' var demo1effect = new Fx.Slide(\'demo1\'); demo1effect.hide(); $(\'course_menu_cont\').setStyle(\'visibility\', \'visible\'); $(\'demo1run1\').addEvent(\'click\', function(e){ e = new Event(e); demo1effect.toggle(); e.stop(); }); '; $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready); } else { $domready = ' var course_menu_hidden = true; $(\'demo1run1\').addEvent(\'click\', function(e){ e = new Event(e); if (course_menu_hidden) { $(\'course_menu_cont\').setStyle(\'visibility\', \'visible\'); course_menu_hidden = false; } else { $(\'course_menu_cont\').setStyle(\'visibility\', \'hidden\'); course_menu_hidden = true; } e.stop(); }); '; $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready); } ?> </div> </td> </tr> </table> </td> </tr> </table> <?php } else { $add_js = "\n\t\tfunction jlms_redirect_form(sel_element) {\n\t\t\tvar id = sel_element.options[sel_element.selectedIndex].value;\n\t\t\tvar redirect_url = '';\n\t\t\tswitch (id) {\n"; foreach ($courses as $course) { $add_js .= "\n\t\t\t\tcase '{$course->id}':\n\t\t\t\t\tredirect_url = '" . str_replace('&', '&', sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=" . $JLMS_SESSION->get('jlms_task') . "&id=" . $course->id)) . "'\n\t\t\t\tbreak;\n"; } $add_js .= "\n\t\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (redirect_url) {\n\t\t\t\ttop.location.href = redirect_url;\n\t\t\t}\n\t\t}\n\t\t"; $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $add_js); ?> <table cellpadding="0" cellspacing="0" border="0" style="float:right" class="jlms_coursebox_cont"> <tr> <td align="right" nowrap="nowrap"> <?php echo _JLMS_CURRENT_COURSE; ?> </td> <td width="120" nowrap="nowrap"> <form name="jlms_change_course" action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " method="post"> <noscript> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="<?php echo $JLMS_SESSION->get('jlms_task'); ?> " /> </noscript> <table cellpadding="0" cellspacing="0" border="0" class="jlms_coursebox"><tr><td> <select name="id" style="width:200px; border:1px solid #666666;" onchange="jlms_redirect_form(this)"> <?php $i = 0; foreach ($courses as $course) { echo '<option value="' . $course->id . '"' . ($id == $course->id ? ' selected="selected"' : '') . '>' . $course->course_name . '</option>'; $i++; } ?> </select> </td><td> <noscript> <input type="submit" name="OK" value="OK" /> </noscript> </td></tr></table> </form> </td> </tr> </table> <?php } ?> </td> </tr> <?php } } ?> </table> <?php } }
function edit(&$menu, &$lists, &$params, $option) { /* in the HTML below, references to "section" were changed to "category" */ global $mosConfig_live_site; ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { if (pressbutton == 'cancel') { submitform( pressbutton ); return; } var form = document.adminForm; <?php if (!$menu->id) { ?> if ( form.name.value == '' ) { alert( 'This Menu item must have a title' ); return; } else { submitform( pressbutton ); } <?php } else { ?> if ( form.name.value == '' ) { alert( 'This Menu item must have a title' ); } else { submitform( pressbutton ); } <?php } ?> } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Edit' : 'Add'; ?> Menu Item :: Blog - Content Category </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="3"> Details </th> </tr> <tr> <td width="10%" align="right">Name:</td> <td width="200px"> <input class="inputbox" type="text" name="name" size="30" maxlength="100" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> " /> </td> <td> </td> </tr> <tr> <td valign="top" align="right"> Category: </td> <td> <?php echo $lists['categoryid']; ?> </td> <td valign="top"> <?php echo mosToolTip('You can select multiple Categories'); ?> </td> </tr> <tr> <td align="right">URL:</td> <td colspan="2"> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td align="right">Parent Item:</td> <td colspan="2"> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right">Ordering:</td> <td colspan="2"> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right">Access Level:</td> <td colspan="2"> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right">Published:</td> <td colspan="2"> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parameters </th> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="link" value="index.php?option=com_content&task=blogcategory&id=0" /> <input type="hidden" name="componentid" value="0" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <?php }
/** * Writes the edit form for new and existing content item * * A new record is defined when <var>$row</var> is passed with the <var>id</var> * property set to 0. * @param mosContent The category object * @param string The html for the groups select list */ function editContent(&$row, $section, &$lists, &$images, &$access, $myid, $sectionid, $task, $Itemid) { global $mosConfig_live_site, $mainframe; mosMakeHtmlSafe($row); require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/HTML_toolbar.php'; // used for spoof hardening $validate = josSpoofValue(); $Returnid = intval(mosGetParam($_REQUEST, 'Returnid', $Itemid)); $tabs = new mosTabs(0, 1); $mainframe->addCustomHeadTag('<link rel="stylesheet" type="text/css" media="all" href="includes/js/calendar/calendar-mos.css" title="green" />'); ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <!-- import the calendar script --> <script language="javascript" type="text/javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/calendar/calendar_mini.js"></script> <!-- import the language module --> <script language="javascript" type="text/javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/calendar/lang/calendar-en.js"></script> <script language="javascript" type="text/javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <script language="javascript" type="text/javascript"> onunload = WarnUser; var folderimages = new Array; <?php $i = 0; foreach ($images as $k => $items) { foreach ($items as $v) { echo "\n\tfolderimages[" . $i++ . "] = new Array( '{$k}','" . addslashes($v->value) . "','" . addslashes($v->text) . "' );"; } } ?> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } // var goodexit=false; // assemble the images back into one field form.goodexit.value=1; var temp = new Array; for (var i=0, n=form.imagelist.options.length; i < n; i++) { temp[i] = form.imagelist.options[i].value; } form.images.value = temp.join( '\n' ); try { form.onsubmit(); } catch(e){} // do field validation if (form.title.value == "") { alert ( "<?php echo addslashes(_E_WARNTITLE); ?> " ); } else if (parseInt('<?php echo $row->sectionid; ?> ')) { // for content items if (getSelectedValue('adminForm','catid') < 1) { alert ( "<?php echo addslashes(_E_WARNCAT); ?> " ); //} else if (form.introtext.value == "") { // alert ( "<?php echo addslashes(_E_WARNTEXT); ?> " ); } else { <?php getEditorContents('editor1', 'introtext'); getEditorContents('editor2', 'fulltext'); ?> submitform(pressbutton); } //} else if (form.introtext.value == "") { // alert ( "<?php echo addslashes(_E_WARNTEXT); ?> " ); } else { // for static content <?php getEditorContents('editor1', 'introtext'); ?> submitform(pressbutton); } } function setgood(){ document.adminForm.goodexit.value=1; } function WarnUser(){ if (document.adminForm.goodexit.value==0) { alert('<?php echo addslashes(_E_WARNUSER); ?> '); window.location="<?php echo sefRelToAbs("index.php?option=com_content&task=" . $task . "§ionid=" . $sectionid . "&id=" . $row->id . "&Itemid=" . $Itemid); ?> "; } } </script> <?php $docinfo = "<strong>" . _E_EXPIRES . "</strong> "; $docinfo .= $row->publish_down . "<br />"; $docinfo .= "<strong>" . _E_VERSION . "</strong> "; $docinfo .= $row->version . "<br />"; $docinfo .= "<strong>" . _E_CREATED . "</strong> "; $docinfo .= $row->created . "<br />"; $docinfo .= "<strong>" . _E_LAST_MOD . "</strong> "; $docinfo .= $row->modified . "<br />"; $docinfo .= "<strong>" . _E_HITS . "</strong> "; $docinfo .= $row->hits . "<br />"; ?> <form action="index.php" method="post" name="adminForm" onSubmit="javascript:setgood();"> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr> <td class="contentheading" > <?php echo $section; ?> / <?php echo $row->id ? _E_EDIT : _E_ADD; ?> <?php echo _E_CONTENT; ?> <a href="javascript: void(0);" onMouseOver="return overlib('<table><?php echo $docinfo; ?> </table>', CAPTION, '<?php echo _E_ITEM_INFO; ?> ', BELOW, RIGHT);" onMouseOut="return nd();"> <strong>[Info]</strong> </a> </td> </tr> </table> <table class="adminform"> <tr> <td> <div style="float: left;"> <?php echo _E_TITLE; ?> <br /> <input class="inputbox" type="text" name="title" size="50" maxlength="100" value="<?php echo $row->title; ?> " /> </div> <div style="float: right;"> <?php // Toolbar Top mosToolBar::startTable(); mosToolBar::save(); mosToolBar::apply('apply_new'); mosToolBar::cancel(); mosToolBar::endtable(); ?> </div> </td> </tr> <?php if ($row->sectionid) { ?> <tr> <td> <?php echo _E_CATEGORY; ?> <br /> <?php echo $lists['catid']; ?> </td> </tr> <?php } ?> <tr> <?php if (intval($row->sectionid) > 0) { ?> <td> <?php echo _E_INTRO . ' (' . _CMN_REQUIRED . ')'; ?> : </td> <?php } else { ?> <td> <?php echo _E_MAIN . ' (' . _CMN_REQUIRED . ')'; ?> : </td> <?php } ?> </tr> <tr> <td> <?php // parameters : areaname, content, hidden field, width, height, rows, cols editorArea('editor1', $row->introtext, 'introtext', '600', '400', '70', '15'); ?> </td> </tr> <?php if (intval($row->sectionid) > 0) { ?> <tr> <td> <?php echo _E_MAIN . ' (' . _CMN_OPTIONAL . ')'; ?> : </td> </tr> <tr> <td> <?php // parameters : areaname, content, hidden field, width, height, rows, cols editorArea('editor2', $row->fulltext, 'fulltext', '600', '400', '70', '15'); ?> </td> </tr> <?php } ?> </table> <?php // Toolbar Bottom mosToolBar::startTable(); mosToolBar::save(); mosToolBar::apply(); mosToolBar::cancel(); mosToolBar::endtable(); ?> <?php $tabs->startPane('content-pane'); $tabs->startTab(_E_IMAGES, 'images-page'); ?> <table class="adminform"> <tr> <td colspan="4"> <?php echo _CMN_SUBFOLDER; ?> :: <?php echo $lists['folders']; ?> </td> </tr> <tr> <td align="top"> <?php echo _E_GALLERY_IMAGES; ?> </td> <td width="2%"> </td> <td align="top"> <?php echo _E_CONTENT_IMAGES; ?> </td> <td align="top"> <?php echo _E_EDIT_IMAGE; ?> </td> </tr> <tr> <td valign="top"> <?php echo $lists['imagefiles']; ?> <br /> <input class="button" type="button" value="<?php echo _E_INSERT; ?> " onclick="addSelectedToList('adminForm','imagefiles','imagelist')" /> </td> <td width="2%"> <input class="button" type="button" value=">>" onclick="addSelectedToList('adminForm','imagefiles','imagelist')" title="<?php echo _E_ADD; ?> "/> <br/> <input class="button" type="button" value="<<" onclick="delSelectedFromList('adminForm','imagelist')" title="<?php echo _E_REMOVE; ?> "/> </td> <td valign="top"> <?php echo $lists['imagelist']; ?> <br /> <input class="button" type="button" value="<?php echo _E_UP; ?> " onclick="moveInList('adminForm','imagelist',adminForm.imagelist.selectedIndex,-1)" /> <input class="button" type="button" value="<?php echo _E_DOWN; ?> " onclick="moveInList('adminForm','imagelist',adminForm.imagelist.selectedIndex,+1)" /> </td> <td valign="top"> <table> <tr> <td align="right"> <?php echo _E_SOURCE; ?> </td> <td> <input class="inputbox" type="text" name= "_source" value="" size="15" /> </td> </tr> <tr> <td align="right" valign="top"> <?php echo _E_ALIGN; ?> </td> <td> <?php echo $lists['_align']; ?> </td> </tr> <tr> <td align="right"> <?php echo _E_ALT; ?> </td> <td> <input class="inputbox" type="text" name="_alt" value="" size="15" /> </td> </tr> <tr> <td align="right"> <?php echo _E_BORDER; ?> </td> <td> <input class="inputbox" type="text" name="_border" value="" size="3" maxlength="1" /> </td> </tr> <tr> <td align="right"> <?php echo _E_CAPTION; ?> : </td> <td> <input class="text_area" type="text" name="_caption" value="" size="30" /> </td> </tr> <tr> <td align="right"> <?php echo _E_CAPTION_POSITION; ?> : </td> <td> <?php echo $lists['_caption_position']; ?> </td> </tr> <tr> <td align="right"> <?php echo _E_CAPTION_ALIGN; ?> : </td> <td> <?php echo $lists['_caption_align']; ?> </td> </tr> <tr> <td align="right"> <?php echo _E_CAPTION_WIDTH; ?> : </td> <td> <input class="text_area" type="text" name="_width" value="" size="5" maxlength="5" /> </td> </tr> <tr> <td align="right"> </td> <td> <input class="button" type="button" value="<?php echo _E_APPLY; ?> " onclick="applyImageProps()" /> </td> </tr> </table> </td> </tr> <tr> <td> <img name="view_imagefiles" src="<?php echo $mosConfig_live_site; ?> /images/M_images/blank.png" width="50" alt="<?php echo _E_NO_IMAGE; ?> " /> </td> <td width="2%"> </td> <td> <img name="view_imagelist" src="<?php echo $mosConfig_live_site; ?> /images/M_images/blank.png" width="50" alt="<?php echo _E_NO_IMAGE; ?> " /> </td> <td> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab(_E_PUBLISHING, 'publish-page'); ?> <table class="adminform"> <?php if ($access->canPublish) { ?> <tr> <td align="left"> <?php echo _E_STATE; ?> </td> <td> <?php echo $lists['state']; ?> </td> </tr> <?php } ?> <tr> <td align="left"> <?php echo _E_ACCESS_LEVEL; ?> </td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td align="left"> <?php echo _E_AUTHOR_ALIAS; ?> </td> <td> <input type="text" name="created_by_alias" size="50" maxlength="100" value="<?php echo $row->created_by_alias; ?> " class="inputbox" /> </td> </tr> <tr> <td align="left"> <?php echo _E_ORDERING; ?> </td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td align="left"> <?php echo _E_START_PUB; ?> </td> <td> <input class="inputbox" type="text" name="publish_up" id="publish_up" size="25" maxlength="19" value="<?php echo $row->publish_up; ?> " /> <input type="reset" class="button" value="..." onclick="return showCalendar('publish_up', 'y-mm-dd');" /> </td> </tr> <tr> <td align="left"> <?php echo _E_FINISH_PUB; ?> </td> <td> <input class="inputbox" type="text" name="publish_down" id="publish_down" size="25" maxlength="19" value="<?php echo $row->publish_down; ?> " /> <input type="reset" class="button" value="..." onclick="return showCalendar('publish_down', 'y-mm-dd');" /> </td> </tr> <tr> <td align="left"> <?php echo _E_SHOW_FP; ?> </td> <td> <input type="checkbox" name="frontpage" value="1" <?php echo $row->frontpage ? 'checked="checked"' : ''; ?> /> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab(_E_METADATA, 'meta-page'); ?> <table class="adminform"> <tr> <td align="left" valign="top"> <?php echo _E_M_DESC; ?> </td> <td> <textarea class="inputbox" cols="45" rows="3" name="metadesc"><?php echo str_replace('&', '&', $row->metadesc); ?> </textarea> </td> </tr> <tr> <td align="left" valign="top"> <?php echo _E_M_KEY; ?> </td> <td> <textarea class="inputbox" cols="45" rows="3" name="metakey"><?php echo str_replace('&', '&', $row->metakey); ?> </textarea> </td> </tr> </table> <?php $tabs->endTab(); $tabs->endPane(); ?> <div style="clear:both;"></div> <input type="hidden" name="images" value="" /> <input type="hidden" name="goodexit" value="0" /> <input type="hidden" name="option" value="com_content" /> <input type="hidden" name="Returnid" value="<?php echo $Returnid; ?> " /> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <input type="hidden" name="version" value="<?php echo $row->version; ?> " /> <input type="hidden" name="sectionid" value="<?php echo $row->sectionid; ?> " /> <input type="hidden" name="created_by" value="<?php echo $row->created_by; ?> " /> <input type="hidden" name="referer" value="<?php echo ampReplace(@$_SERVER['HTTP_REFERER']); ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="<?php echo $validate; ?> " value="1" /> </form> <?php }
function showUserGroups($course_id, $option, &$rows, &$lists) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; if ( ((pressbutton == 'edit_usergroup') || (pressbutton == 'export_usergroup')) && (form.boxchecked.value == '0')) { alert('<?php echo _JLMS_ALERT_SELECT_ITEM; ?> '); } else if ((pressbutton == 'usergroup_delete') && (form.boxchecked.value == '0')) { alert('<?php echo _JLMS_ALERT_SELECT_ITEM; ?> '); } else { form.task.value = pressbutton; form.submit(); } } //--> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); JLMS_TMPL::ShowHeader('userman', _JLMS_USERGROUPS_TITLE, $hparams); $JLMS_ACL =& JLMSFactory::getACL(); JLMS_TMPL::OpenTS(); ?> <form action="<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid; ?> " method="post" name="adminForm"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center">#</<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('users', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows) + 1; ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } else { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_USERS_TBL_HEAD_GROUPNAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_USERS_TBL_HEAD_GROUPDESCR; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php if ($JLMS_ACL->CheckPermissions('users', 'manage_teachers')) { ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry2'); ?> "> <td align="center">-</td> <td align="center"> </td> <td><?php $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=view_assistants&id=" . $course_id; ?> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo _JLMS_USERS_GROUP_LINK_TITLE; ?> "> <?php echo _JLMS_USER_ASSIST_GROUP_NAME; ?> </a> </td> <td><?php echo _JLMS_USER_ASSIST_GROUP_DESCR; ?> </td> </tr> <?php } ?> <?php if ($lists['no_group']) { ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry2'); ?> "> <td align="center">-</td> <td align="center"> <?php if ($JLMS_ACL->CheckPermissions('users', 'manage')) { echo mosHTML::idBox(0, 0); } else { echo ' '; } ?> </td> <td><?php $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=view_users&course_id=" . $course_id . "&id=0"; ?> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo _JLMS_USERS_GROUP_LINK_TITLE; ?> "> <?php echo _JLMS_USER_NO_GROUP_NAME; ?> </a> </td> <td><?php echo _JLMS_USER_ASSIST_GROUP_DESCR; ?> </td> </tr> <?php } $k = 1; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=view_users&course_id=" . $course_id . "&id=" . $row->id; $checked = mosHTML::idBox($i + 1, $row->id); if (!$JLMS_ACL->CheckPermissions('users', 'manage')) { $checked = ' '; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center"><?php echo $i + 1; ?> </td> <td><?php echo $checked; ?> </td> <td align="left"> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo _JLMS_USERS_GROUP_LINK_TITLE; ?> "> <?php echo $row->ug_name; ?> </a> </td> <td><?php echo $row->ug_description; ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="course_users" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="row_id" value="0" /> <input type="hidden" name="state" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); $link_new = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=new_usergroup&id=" . $course_id; $link_csvdelete = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=user_csv_delete&id=" . $course_id; $controls = array(); if ($JLMS_ACL->CheckPermissions('users', 'manage')) { $controls[] = array('href' => "javascript:submitbutton('export_usergroup');", 'title' => _JLMS_USER_ALT_EXPGROUP, 'img' => 'export'); $controls[] = array('href' => 'spacer'); $controls[] = array('href' => ampReplace(sefRelToAbs($link_new)), 'title' => _JLMS_USER_ALT_NEWGROUP, 'img' => 'addusergroup'); $controls[] = array('href' => "javascript:submitbutton('usergroup_delete');", 'title' => _JLMS_USER_ALT_DELGROUP, 'img' => 'delusergroup'); $controls[] = array('href' => "javascript:submitbutton('edit_usergroup');", 'title' => _JLMS_USER_ALT_EDITGROUP, 'img' => 'editusergroup'); $controls[] = array('href' => 'spacer'); $controls[] = array('href' => ampReplace(sefRelToAbs($link_csvdelete)), 'title' => _JLMS_USERS_CSV_DELETE, 'img' => 'delete'); } JLMS_TMPL::ShowControlsFooter($controls); JLMS_TMPL::CloseMT(); }
public static function display(&$rows, $params, $pageNav, $limitstart, $limit, $total, $totalRows, $searchword) { global $mosConfig_hideCreateDate; global $mosConfig_live_site, $option, $Itemid; $c = count($rows); $image = mosAdminMenus::ImageCheck('google.png', '/images/M_images/', NULL, NULL, 'Google', 'Google', 1); $searchword = urldecode($searchword); $searchword = htmlspecialchars($searchword, ENT_QUOTES); // number of matches found echo '<br/>'; eval('echo "' . _CONCLUSION . '";'); ?> <a href="http://www.google.com/search?q=<?php echo $searchword; ?> " target="_blank"> <?php echo $image; ?> </a> </td> </tr> </table> <br /> <div align="center"> <?php echo $pageNav->writePagesCounter(); $ordering = strtolower(strval(mosGetParam($_REQUEST, 'ordering', 'newest'))); $searchphrase = strtolower(strval(mosGetParam($_REQUEST, 'searchphrase', 'any'))); $searchphrase = htmlspecialchars($searchphrase); $cleanWord = htmlspecialchars($searchword); $link = $mosConfig_live_site . "/index.php?option={$option}&Itemid={$Itemid}&searchword={$cleanWord}&searchphrase={$searchphrase}&ordering={$ordering}"; echo $pageNav->getLimitBox($link); ?> </div> <table class="contentpaneopen<?php echo $params->get('pageclass_sfx'); ?> "> <tr class="<?php echo $params->get('pageclass_sfx'); ?> "> <td> <?php $z = $limitstart + 1; $end = $limit + $z; if ($end > $total) { $end = $total + 1; } for ($i = $z; $i < $end; $i++) { $row = $rows[$i - 1]; if ($row->created) { $created = mosFormatDate($row->created, _DATE_FORMAT_LC); } else { $created = ''; } ?> <fieldset> <div> <span class="small<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo $i . '. '; ?> </span> <?php if ($row->href) { $row->href = ampReplace($row->href); if ($row->browsernav == 1) { ?> <a href="<?php echo sefRelToAbs($row->href); ?> " target="_blank"> <?php } else { ?> <a href="<?php echo sefRelToAbs($row->href); ?> "> <?php } } echo $row->title; if ($row->href) { ?> </a> <?php } if ($row->section) { ?> <br/> <span class="small<?php echo $params->get('pageclass_sfx'); ?> "> (<?php echo $row->section; ?> ) </span> <?php } ?> </div> <div> <?php echo ampReplace($row->text); ?> </div> <?php if (!$mosConfig_hideCreateDate) { ?> <div class="small<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo $created; ?> </div> <?php } ?> </fieldset> <br/> <?php } ?> </td> </tr> <?php }
function formStart($javascriptType = '', $html = 0, $images = null) { global $_VERSION; $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false; if ($joomAca15) { $editor =& JFactory::getEditor(); } mosCommonHTML::loadOverlib(); echo '<script language="javascript" type="text/javascript">'; switch ($javascriptType) { case 'edit_mailing': if (!$joomAca15) { ?> var folderimages = new Array; <?php $i = 0; foreach ($images as $k => $items) { foreach ($items as $v) { echo "folderimages[" . $i++ . "] = new Array( '{$k}','" . addslashes(ampReplace($v->value)) . "','" . addslashes(ampReplace($v->text)) . "' );\t"; } } } ?> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'show') { submitform( pressbutton ); return; } <?php if (!$joomAca15) { ?> var temp = new Array; for (var i=0, n=form.imagelist.options.length; i < n; i++) { temp[i] = form.imagelist.options[i].value; } form.images.value = temp.join( '\n' ); <?php } ?> if (form.subject.value == ""){ alert( "Mailing must have a title" ); } else { <?php if ($html != 0) { if ($joomAca15) { echo $editor->save('content'); } else { getEditorContents('editor1', 'content'); } } ?> if(pressbutton){ if (pressbutton == 'saveSend') { if (!confirm('Are you sure you want to proceed?')){return;} form.action = 'index2.php?option=com_acajoom&act=mailing'; } form.task.value=pressbutton; } form.submit(); } } <?php break; case 'show_mailing': ?> function checkcid(myField) { myField.checked = true; isChecked(true); } function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } if (pressbutton == 'sendNewsletter') { if (!confirm('Are you sure you want to proceed?')){return;} form.action = 'index2.php?option=com_acajoom&act=mailing'; } submitform( pressbutton ); } <?php break; case 'configpanel': ?> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } if (pressbutton == 'sendQueue') { form.action = 'index2.php?option=com_acajoom&act=mailing'; } submitform( pressbutton ); } <?php break; case 'editlist': ?> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } <?php if ($GLOBALS[ACA . 'listHTMLeditor'] == '1') { if ($joomAca15) { echo $editor->save('list_desc'); } else { getEditorContents('editor1', 'list_desc'); } } if ($html) { if ($joomAca15) { $editor->save('layout'); $editor->save('subscribemessage'); $editor->save('unsubscribemessage'); } else { getEditorContents('editor2', 'layout'); getEditorContents('editor3', 'subscribemessage'); getEditorContents('editor4', 'unsubscribemessage'); } } ?> submitform( pressbutton ); } <?php break; default: ?> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } submitform( pressbutton ); } <?php break; } echo '</script>'; }
* @author Mambo Foundation Inc see README.php * @copyright Mambo Foundation Inc. * See COPYRIGHT.php for copyright notices and details. * @license GNU/GPL Version 2, see LICENSE.php * Mambo is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 of the License. */ /** ensure this file is being included by a parent file */ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); // load the html drawing class require_once $mainframe->getPath('front_html'); global $database, $my; global $mosConfig_live_site; $return = mosGetParam($_SERVER, 'REQUEST_URI', null); $return = ampReplace($return); $menuhandler =& mosMenuHandler::getInstance(); $menu =& $menuhandler->getMenuByID($Itemid); $params =& new mosParameters($menu->params); $params->def('page_title', 1); $params->def('header_login', $menu->name); $params->def('header_logout', $menu->name); $params->def('pageclass_sfx', ''); $params->def('back_button', $mainframe->getCfg('back_button')); $params->def('login', $mosConfig_live_site); $params->def('logout', $mosConfig_live_site); $params->def('login_message', 0); $params->def('logout_message', 0); $params->def('description_login', 1); $params->def('description_logout', 1); $params->def('description_login_text', T_('To access the Private areas of this site please Login'));
function JLMS_saveCertificate($course_id, $option, $crtf_type, $redirect_url = '') { global $my, $JLMS_DB, $Itemid; $JLMS_ACL =& JLMSFactory::getACL(); $crtf_id = 0; /*echo '<pre>'; print_r($_REQUEST);*/ if ($course_id && $JLMS_ACL->CheckPermissions('docs', 'view')) { $crtf_name = isset($_REQUEST['crtf_name']) ? $_REQUEST['crtf_name'] : ''; $crtf_name = get_magic_quotes_gpc() ? stripslashes($crtf_name) : $crtf_name; $crtf_name = ampReplace(strip_tags($crtf_name)); $crtf_name = $JLMS_DB->GetEscaped($crtf_name); $crtf_text = isset($_REQUEST['crtf_text']) ? $_REQUEST['crtf_text'] : ''; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_align = intval(mosGetParam($_REQUEST, 'crtf_align', 0)); $published = intval(mosGetParam($_REQUEST, 'published', 1)); $crtf_shadow = intval(mosGetParam($_REQUEST, 'crtf_shadow', 0)); $crtf_font = strval(mosGetParam($_REQUEST, 'crtf_font', 0)); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if ($crtf_shadow) { $crtf_shadow = 1; } if (!in_array($crtf_align, array(0, 1, 2))) { $crtf_align = 0; } $text_x = intval(mosGetParam($_REQUEST, 'text_x', 0)); $text_y = intval(mosGetParam($_REQUEST, 'text_y', 0)); $text_size = intval(mosGetParam($_REQUEST, 'text_size', 0)); $new_file = false; $file_id = 0; if (isset($_FILES['userfile']) && !empty($_FILES['userfile']['name'])) { $file_id = JLMS_uploadFile($course_id); $new_file = true; } $add_query = ''; $crtf_id = 0; if ($crtf_type == 2) { $crtf_id = intval(mosGetParam($_REQUEST, 'crtf_id', 0)); $add_query = " AND id = '" . $crtf_id . "'"; } $query = "SELECT * FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $crtf_type . "' AND parent_id = 0" . $add_query; $JLMS_DB->SetQuery($query); $old_crt = $JLMS_DB->LoadObjectList(); if (count($old_crt)) { $old_file = $old_crt[0]->file_id; if ($old_file && $new_file) { $files = array(); $files[] = $old_file; JLMS_deleteFiles($files); } $crtf_id = $old_crt[0]->id; $query = "UPDATE #__lms_certificates SET published = {$published}, crtf_name = '" . $crtf_name . "', crtf_text = '" . $crtf_text . "', crtf_align = {$crtf_align}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . "" . ($new_file ? ", file_id = '" . $file_id . "'" : '') . " WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $crtf_type . "' AND parent_id = 0" . $add_query; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } else { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, published, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size" . ($new_file ? ", file_id" : '') . ", crtf_type, crtf_font) VALUES ( 0, '" . $course_id . "', '" . $published . "', '" . $crtf_name . "', '" . $crtf_text . "', {$crtf_align}, {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "'" . ($new_file ? ",'" . $file_id . "'" : '') . ", '" . $crtf_type . "', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_id = $JLMS_DB->insertid(); } $crtf_id = intval($crtf_id); /* 23 october 2007 - (DEN) */ /* handle custom text fields */ $ctxt_mes_ids = josGetArrayInts('ctxt_mes_id', $_REQUEST); $ctxt_mes_text = isset($_REQUEST['ctxt_mes_text']) ? $_REQUEST['ctxt_mes_text'] : array(); $ctxt_mes_shadow_hid = mosGetParam($_REQUEST, 'ctxt_mes_shadow_hid', array()); $ctxt_mes_x = mosGetParam($_REQUEST, 'ctxt_mes_x', array()); $ctxt_mes_y = mosGetParam($_REQUEST, 'ctxt_mes_y', array()); $ctxt_mes_h = mosGetParam($_REQUEST, 'ctxt_mes_h', array()); $ctxt_mes_font = mosGetParam($_REQUEST, 'ctxt_mes_font', array()); $p_ids = array(); $i = 0; $add_cmes_ids = array(); /*print_r($ctxt_mes_ids);*/ foreach ($ctxt_mes_ids as $cmid) { if (isset($ctxt_mes_text[$i]) && isset($ctxt_mes_x[$i]) && isset($ctxt_mes_y[$i]) && isset($ctxt_mes_h[$i]) && isset($ctxt_mes_font[$i]) && isset($ctxt_mes_shadow_hid[$i]) && $ctxt_mes_text[$i]) { $crtf_shadow = $ctxt_mes_shadow_hid[$i] ? 1 : 0; $crtf_font = ''; $text_x = intval($ctxt_mes_x[$i]); if ($text_x < 0) { $text_x = 0; } $text_y = intval($ctxt_mes_y[$i]); if ($text_y < 0) { $text_y = 0; } $text_size = intval($ctxt_mes_h[$i]); if ($text_size < 0) { $text_size = 0; } $crtf_text = $ctxt_mes_text[$i]; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_font = strval($ctxt_mes_font[$i]); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if (!$cmid) { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size, crtf_type, crtf_font) VALUES ( {$crtf_id}, '" . $course_id . "', '', '" . $crtf_text . "', " . $i . ", {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "', '-2', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_cmes_id = $JLMS_DB->insertid(); /*echo $JLMS_DB->geterrormsg();*/ $add_cmes_ids[] = $crtf_cmes_id; } else { $query = "UPDATE #__lms_certificates SET crtf_text = '" . $crtf_text . "', crtf_align = {$i}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . " WHERE course_id = '" . $course_id . "' AND crtf_type = '-2' AND parent_id = {$crtf_id} AND id = {$cmid}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $add_cmes_ids[] = $cmid; } } $i++; } if (empty($add_cmes_ids)) { $add_cmes_ids = array(0); } /*print_r($add_cmes_ids);*/ $add_cmes_ids_t = implode(',', $add_cmes_ids); $query = "DELETE FROM #__lms_certificates WHERE course_id = {$course_id} AND parent_id = {$crtf_id} AND crtf_type = '-2' AND id NOT IN ({$add_cmes_ids_t})"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); /*die;*/ /* end of 'custom text fields' mod */ if ($crtf_id) { $JLMS_ACL =& JLMSFactory::getACL(); $lroles = $JLMS_ACL->GetSystemRolesIds(1); $add_certificates = josGetArrayInts('certificate_types', $_REQUEST); $types = array(); if (!empty($add_certificates)) { foreach ($add_certificates as $add_cert) { if ($add_cert && in_array($add_cert, $lroles)) { $certificate_default = intval(mosGetParam($_REQUEST, 'certificate_default_' . $add_cert, 0)); if (!$certificate_default) { $crtf_text = isset($_REQUEST['crtf_text_' . $add_cert]) ? $_REQUEST['crtf_text_' . $add_cert] : ''; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_align = intval(mosGetParam($_REQUEST, 'crtf_align_' . $add_cert, 0)); $crtf_shadow = intval(mosGetParam($_REQUEST, 'crtf_shadow_' . $add_cert, 0)); $crtf_font = strval(mosGetParam($_REQUEST, 'crtf_font_' . $add_cert, 0)); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if ($crtf_shadow) { $crtf_shadow = 1; } if (!in_array($crtf_align, array(0, 1, 2))) { $crtf_align = 0; } $text_x = intval(mosGetParam($_REQUEST, 'text_x_' . $add_cert, 0)); $text_y = intval(mosGetParam($_REQUEST, 'text_y_' . $add_cert, 0)); $text_size = intval(mosGetParam($_REQUEST, 'text_size_' . $add_cert, 0)); $new_file = false; $file_id = 0; if (isset($_FILES['userfile_' . $add_cert]) && !empty($_FILES['userfile_' . $add_cert]['name'])) { $file_id = JLMS_uploadFile($course_id, 'userfile_' . $add_cert); $new_file = true; } $query = "SELECT * FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $add_cert . "' AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $old_crt = $JLMS_DB->LoadObjectList(); if (count($old_crt)) { $old_file = $old_crt[0]->file_id; if ($old_file && $new_file) { $files = array(); $files[] = $old_file; JLMS_deleteFiles($files); } $crtf_id_c = $old_crt[0]->id; $query = "UPDATE #__lms_certificates SET crtf_name = '" . $crtf_name . "', crtf_text = '" . $crtf_text . "', crtf_align = {$crtf_align}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . "" . ($new_file ? ", file_id = '" . $file_id . "'" : '') . " WHERE course_id = '" . $course_id . "' AND crtf_type = '" . $add_cert . "' AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } else { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size" . ($new_file ? ", file_id" : '') . ", crtf_type, crtf_font) VALUES ( {$crtf_id}, '" . $course_id . "', '" . $crtf_name . "', '" . $crtf_text . "', {$crtf_align}, {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "'" . ($new_file ? ",'" . $file_id . "'" : '') . ", '" . $add_cert . "', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_id_c = $JLMS_DB->insertid(); } /* 23 october 2007 - (DEN) */ /* handle custom text fields */ $ctxt_mes_ids = josGetArrayInts('ctxt_mes_id_' . $add_cert, $_REQUEST); $ctxt_mes_text = isset($_REQUEST['ctxt_mes_text_' . $add_cert]) ? $_REQUEST['ctxt_mes_text_' . $add_cert] : array(); $ctxt_mes_shadow_hid = mosGetParam($_REQUEST, 'ctxt_mes_shadow_hid_' . $add_cert, array()); $ctxt_mes_x = mosGetParam($_REQUEST, 'ctxt_mes_x_' . $add_cert, array()); $ctxt_mes_y = mosGetParam($_REQUEST, 'ctxt_mes_y_' . $add_cert, array()); $ctxt_mes_h = mosGetParam($_REQUEST, 'ctxt_mes_h_' . $add_cert, array()); $ctxt_mes_font = mosGetParam($_REQUEST, 'ctxt_mes_font_' . $add_cert, array()); $p_ids = array(); $i = 0; $add_cmes_ids = array(); foreach ($ctxt_mes_ids as $cmid) { if (isset($ctxt_mes_text[$i]) && isset($ctxt_mes_x[$i]) && isset($ctxt_mes_y[$i]) && isset($ctxt_mes_h[$i]) && isset($ctxt_mes_font[$i]) && isset($ctxt_mes_shadow_hid[$i]) && $ctxt_mes_text[$i]) { $crtf_shadow = $ctxt_mes_shadow_hid[$i] ? 1 : 0; $crtf_font = ''; $text_x = intval($ctxt_mes_x[$i]); if ($text_x < 0) { $text_x = 0; } $text_y = intval($ctxt_mes_y[$i]); if ($text_y < 0) { $text_y = 0; } $text_size = intval($ctxt_mes_h[$i]); if ($text_size < 0) { $text_size = 0; } $crtf_text = $ctxt_mes_text[$i]; $crtf_text = get_magic_quotes_gpc() ? stripslashes($crtf_text) : $crtf_text; $crtf_text = ampReplace(strip_tags($crtf_text)); $crtf_text = $JLMS_DB->GetEscaped($crtf_text); $crtf_font = strval($ctxt_mes_font[$i]); if (!preg_match("/^[a-zA-Z0-9\\-\\_\\s]+\\.ttf\$/", $crtf_font)) { $crtf_font = 'arial.ttf'; } if (!$cmid) { $query = "INSERT INTO #__lms_certificates (parent_id, course_id, crtf_name, crtf_text, crtf_align, crtf_shadow, text_x, text_y, text_size, crtf_type, crtf_font) VALUES ( {$crtf_id_c}, '" . $course_id . "', '', '" . $crtf_text . "', " . $i . ", {$crtf_shadow}, '" . $text_x . "', '" . $text_y . "', '" . $text_size . "', '-2', " . $JLMS_DB->quote($crtf_font) . ")"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $crtf_cmes_id = $JLMS_DB->insertid(); $add_cmes_ids[] = $crtf_cmes_id; } else { $query = "UPDATE #__lms_certificates SET crtf_text = '" . $crtf_text . "', crtf_align = {$i}, crtf_shadow = {$crtf_shadow}, text_x = '" . $text_x . "', text_y = '" . $text_y . "', text_size = '" . $text_size . "', crtf_font = " . $JLMS_DB->quote($crtf_font) . " WHERE course_id = '" . $course_id . "' AND crtf_type = '-2' AND parent_id = {$crtf_id_c} AND id = {$cmid}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $add_cmes_ids[] = $cmid; } } $i++; } if (empty($add_cmes_ids)) { $add_cmes_ids = array(0); } $add_cmes_ids_t = implode(',', $add_cmes_ids); $query = "DELETE FROM #__lms_certificates WHERE course_id = {$course_id} AND parent_id = {$crtf_id_c} AND crtf_type = '-2' AND id NOT IN ({$add_cmes_ids_t})"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); /* end of 'custom text fields' mod */ $types[] = $add_cert; } } } } if (empty($types)) { $types = array(-2); } else { $types[] = -2; } /*print_r($types);*/ $types_str = implode(',', $types); $query = "SELECT id, file_id FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type NOT IN ({$types_str}) AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $old_sec_certs = $JLMS_DB->LoadObjectList(); $old_files = array(); $old_sec_cert_ids = array(); if (!empty($old_sec_certs)) { foreach ($old_sec_certs as $osc) { $old_files[] = $osc->file_id; $old_sec_cert_ids[] = $osc->id; } JLMS_deleteFiles($old_files); } $query = "DELETE FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type NOT IN ({$types_str}) AND parent_id = {$crtf_id}"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); if (!empty($old_sec_cert_ids)) { $osc_t = implode(',', $old_sec_cert_ids); $query = "DELETE FROM #__lms_certificates WHERE course_id = '" . $course_id . "' AND crtf_type = '-2' AND parent_id IN ({$osc_t})"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } } } /*die;*/ if (!$redirect_url) { $redirect_url = "index.php?option={$option}&Itemid={$Itemid}&task=gb_certificates&id={$course_id}"; } JLMSRedirect(sefRelToAbs(str_replace('{id}', $crtf_id, $redirect_url))); }
function showCourseDetails($id, &$row, &$params, $option, &$lists, $view_type = 'view') { $_JLMS_PLUGINS =& JLMSFactory::getPlugins(); global $Itemid, $my, $JLMS_CONFIG, $JLMS_SESSION; $count_modules = 0; $JLMS_ACL =& JLMSFactory::getACL(); if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) { if ($params->get('homework_view') && $JLMS_CONFIG->get('course_homework')) { $count_modules++; } if ($params->get('agenda_view')) { $count_modules++; } if ($params->get('dropbox_view')) { $count_modules++; } if ($params->get('mailbox_view')) { $count_modules++; } if ($params->get('certificates_view')) { $count_modules++; } if ($params->get('latest_forum_posts_view')) { $count_modules++; } if ($count_modules) { ?> <?php } } JLMS_TMPL::OpenMT(); $hparams = array(); if ($view_type == 'view') { $hparams['simple_menu'] = true; $hparams['sys_msg'] = _JLMS_MESSAGE_SHORT_COURSE_INFO; } if ($view_type == 'offerWL') { $hparams['sys_msg'] = _JLMS_MESSAGE_OFFER_JOIN_WAITING_LIST; } elseif ($view_type == 'inWL') { $hparams['sys_msg'] = _JLMS_MESSAGE_ALREADY_IN_WATING_LIST; $JLMS_CONFIG->set('enableterms', 0); } if ($JLMS_SESSION->get('joomlalms_just_joined', 0)) { if (isset($hparams['sys_msg'])) { $hparams['sys_msg'] = $JLMS_SESSION->get('joomlalms_sys_message', '') . '<br />' . $hparams['sys_msg']; } else { $hparams['sys_msg'] = $JLMS_SESSION->get('joomlalms_sys_message', ''); } $JLMS_SESSION->clear('joomlalms_just_joined'); } $toolbar = array(); $JLMS_ACL =& JLMSFactory::getACL(); if ($JLMS_ACL->CheckPermissions('course', 'manage_settings')) { $toolbar[] = array('btn_type' => 'newtopic', 'btn_js' => "index.php?option={$option}&Itemid={$Itemid}&task=add_topic&id={$id}", 'btn_str' => _JLMS_TOPIC_T_ADD); $toolbar[] = array('btn_type' => 'settings', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=settings&id={$id}")); $toolbar[] = array('btn_type' => 'edit', 'btn_js' => ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=edit_course&id={$id}&is_inside=1"))); } elseif ($view_type == 'view' || $view_type == 'offerWL' || $view_type == 'inWL') { $hparams['simple_menu'] = true; if ($my->id && $row->self_reg && JLMS_checkCourseGID($my->id, $row->gid)) { //check that enrollment is available and user gid is allowed if ($row->paid) { if ($view_type != 'inWL') { $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('subscription','');"); } } else { if ($view_type != 'inWL') { $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('course_subscribe','');"); } } if ($view_type != 'inWL') { $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses")); } else { $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses")); } $hparams['toolbar_position'] = 'center'; $html_code_before_toolbar = "\n\t\t\t\t<form action='" . sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}") . "' method='post' name='adminForm_enroll'>\n\t\t\t\t<script language='javascript' type='text/javascript'>\n\t\t\t\t\t<!--\n\n\t\t\t\t\tfunction submitbutton(pressbutton) {\n\t\t\t\t\t\tvar form = document.adminForm_enroll;"; if ($JLMS_CONFIG->get('enableterms') && !$row->paid) { $html_code_before_toolbar .= "\n\t\t\t\t\t\tif( (pressbutton == 'course_subscribe') && (document.getElementById('jlms_agreement').checked == false) ){\n\t\t\t\t\t\t\talert( '" . addslashes(_JLMS_AGREEMENT) . "' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t"; } else { $html_code_before_toolbar .= "\n\t\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t"; } $html_code_before_toolbar .= "\n\t\t\t\t\t\t\t}\n\t\t\t\t\t//-->\n\t\t\t\t\t</script>\n\t\t\t\t\t"; if ($JLMS_CONFIG->get('enableterms') && !$row->paid) { $html_code_before_toolbar .= "\n\t\t\t\t\t<table align='center' class='jlms_table_no_borders'><tr><td width='20'>\n\t\t\t\t\t\t<input type='checkbox' name='agreement' id='jlms_agreement' />\n\t\t\t\t\t</td><td style='text-align:left'>\n\t\t\t\t\t\t<label for='jlms_agreement'>" . $JLMS_CONFIG->get('jlms_terms') . "</label>\n\t\t\t\t\t</td></tr></table>\n\t\t\t\t\t"; } if ($row->paid) { $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='subscription' />\n\t\t\t\t\t\t<input type='hidden' name='cid[]' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t"; } else { $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='courses' />\n\t\t\t\t\t\t<input type='hidden' name='id' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t"; } $hparams['html_code_before_toolbar'] = $html_code_before_toolbar; } else { $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses")); } } elseif ($view_type == 'future_course') { $hparams['simple_menu'] = true; if ($row->publish_start) { $hparams['sys_msg'] = str_replace('{date}', JLMS_dateToDisplay($row->start_date), _JLMS_COURSE_IS_PENDING_MSG); } else { $query = "SELECT start_date FROM #__lms_users_in_groups WHERE course_id = " . $row->id . " AND user_id = " . $my->id; global $JLMS_DB; $JLMS_DB->SetQuery($query); $user_start = $JLMS_DB->LoadResult(); $hparams['sys_msg'] = str_replace('{date}', JLMS_dateToDisplay($user_start), _JLMS_COURSE_USER_IS_PENDING); } } JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_DETAILS, $hparams, $toolbar); $_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $id; $_JLMS_PLUGINS->trigger('onAboveCourseDetailsPage', $plugin_args); if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff() && $count_modules) { $custom_sections = array(); if ($JLMS_CONFIG->get('course_homework') && $params->get('homework_view')) { $txt = JLMS_showMyHomeWork($option, $Itemid, $lists['my_hw']); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('agenda_view')) { $txt = JLMS_showMyAgenda($option, $Itemid, $lists['my_announcements']); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('dropbox_view')) { $txt = JLMS_showMyDropBox($option, $Itemid, $lists['my_dropbox'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('mailbox_view')) { $txt = JLMS_showMyMailBox($option, $Itemid, $lists['my_mailbox'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('certificates_view')) { $txt = JLMS_showMyCertificates($option, $Itemid, $lists['my_certificates'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($JLMS_CONFIG->get('plugin_forum') && $params->get('latest_forum_posts_view')) { $txt = JLMS_showLatestForumPosts($option, $Itemid, $lists['latest_forum_posts'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } JLMS_TMPL::ShowCustomSection($custom_sections, 1, 1); } $show_description = true; if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) { if (!$params->get('show_description', 1)) { $show_description = false; } } if ($show_description) { $text = JLMS_ShowText_WithFeatures($row->course_description); JLMS_TMPL::ShowSection($text); } //$_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $id; $_JLMS_PLUGINS->trigger('onBelowCourseDescription', $plugin_args); /*Fix short course description + all comments*/ if (isset($lists['short']) && !$lists['short']) { if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) { //show topics of the course global $JLMS_DB; $query = "SELECT count(*) FROM #__lms_topics WHERE course_id = {$id}"; $JLMS_DB->SetQuery($query); $is_any_topic = $JLMS_DB->LoadResult(); if ($is_any_topic) { JLMS_TMPL::OpenTS(); $course = new JLMS_Course_HomePage($id); $course->listTopics(); JLMS_TMPL::CloseTS(); } } } //$_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $id; $_JLMS_PLUGINS->trigger('onBelowCourseDetailsPage', $plugin_args); JLMS_TMPL::CloseMT(); }
public static function modoutput_feed(&$module, &$params, $moduleclass_sfx) { global $mosConfig_absolute_path, $mosConfig_cachepath; // check if cache directory is writeable $cacheDir = $mosConfig_cachepath . '/'; if (!is_writable($cacheDir)) { $module->content = 'Cache Directory Unwriteable'; return; } $rssurl = $params->get('rssurl'); $rssitems = $params->get('rssitems', 5); $rssdesc = $params->get('rssdesc', 1); $rssimage = $params->get('rssimage', 1); $rssitemdesc = $params->get('rssitemdesc', 1); $words = $params->def('word_count', 0); $rsstitle = $params->get('rsstitle', 1); $rsscache = $params->get('rsscache', 3600); $contentBuffer = ''; $LitePath = $mosConfig_absolute_path . '/includes/Cache/Lite.php'; require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_rss.php'; $rssDoc = new xml_domit_rss_document(); $rssDoc->setRSSTimeout(2); $rssDoc->useCacheLite(true, $LitePath, $cacheDir, $rsscache); $success = $rssDoc->loadRSS($rssurl); if ($success) { $content_buffer = ''; $totalChannels = $rssDoc->getChannelCount(); for ($i = 0; $i < $totalChannels; $i++) { $currChannel =& $rssDoc->getChannel($i); $elements = $currChannel->getElementList(); $iUrl = 0; foreach ($elements as $element) { //image handling if ($element == 'image') { $image =& $currChannel->getElement(DOMIT_RSS_ELEMENT_IMAGE); $iUrl = $image->getUrl(); $iTitle = $image->getTitle(); } } // feed title $content_buffer = '<table cellpadding="0" cellspacing="0" class="moduletable' . $moduleclass_sfx . '">' . "\n"; if ($currChannel->getTitle() && $rsstitle) { $feed_title = $currChannel->getTitle(); $feed_title = mosCommonHTML::newsfeedEncoding($rssDoc, $feed_title); $content_buffer .= "<tr>\n"; $content_buffer .= "\t<td>\n"; $content_buffer .= "\t\t<strong>\n"; $content_buffer .= "\t\t<a href=\"" . ampReplace($currChannel->getLink()) . "\" target=\"_blank\">\n"; $content_buffer .= $feed_title . "</a>\n"; $content_buffer .= "\t\t</strong>\n"; $content_buffer .= "\t</td>\n"; $content_buffer .= "</tr>\n"; } // feed description if ($rssdesc) { $feed_descrip = $currChannel->getDescription(); $feed_descrip = mosCommonHTML::newsfeedEncoding($rssDoc, $feed_descrip); $content_buffer .= "<tr>\n"; $content_buffer .= "\t<td>\n"; $content_buffer .= $feed_descrip; $content_buffer .= "\t</td>\n"; $content_buffer .= "</tr>\n"; } // feed image if ($rssimage && $iUrl) { $content_buffer .= "<tr>\n"; $content_buffer .= "\t<td align=\"center\">\n"; $content_buffer .= "\t\t<image src=\"" . $iUrl . "\" alt=\"" . @$iTitle . "\"/>\n"; $content_buffer .= "\t</td>\n"; $content_buffer .= "</tr>\n"; } $actualItems = $currChannel->getItemCount(); $setItems = $rssitems; if ($setItems > $actualItems) { $totalItems = $actualItems; } else { $totalItems = $setItems; } $content_buffer .= "<tr>\n"; $content_buffer .= "\t<td>\n"; $content_buffer .= "\t\t<ul class=\"newsfeed" . $moduleclass_sfx . "\">\n"; for ($j = 0; $j < $totalItems; $j++) { $currItem =& $currChannel->getItem($j); // item title $item_title = $currItem->getTitle(); $item_title = mosCommonHTML::newsfeedEncoding($rssDoc, $item_title); // START fix for RSS enclosure tag url not showing $content_buffer .= "<li class=\"newsfeed" . $moduleclass_sfx . "\">\n"; $content_buffer .= "\t<strong>\n"; if ($currItem->getLink()) { $content_buffer .= " <a href=\"" . ampReplace($currItem->getLink()) . "\" target=\"_blank\">\n"; $content_buffer .= " " . $item_title . "</a>\n"; } else { if ($currItem->getEnclosure()) { $enclosure = $currItem->getEnclosure(); $eUrl = $enclosure->getUrl(); $content_buffer .= " <a href=\"" . ampReplace($eUrl) . "\" target=\"_blank\">\n"; $content_buffer .= " " . $item_title . "</a>\n"; } else { if ($currItem->getEnclosure() && $currItem->getLink()) { $enclosure = $currItem->getEnclosure(); $eUrl = $enclosure->getUrl(); $content_buffer .= " <a href=\"" . ampReplace($currItem->getLink()) . "\" target=\"_blank\">\n"; $content_buffer .= " " . $item_title . "</a><br/>\n"; $content_buffer .= " <a href=\"" . ampReplace($eUrl) . "\" target=\"_blank\"><u>Download</u></a>\n"; } } } $content_buffer .= "\t</strong>\n"; // END fix for RSS enclosure tag url not showing // item description if ($rssitemdesc) { // item description $text = $currItem->getDescription(); $text = mosCommonHTML::newsfeedEncoding($rssDoc, $text); // word limit check if ($words) { $texts = explode(' ', $text); $count = count($texts); if ($count > $words) { $text = ''; for ($i = 0; $i < $words; $i++) { $text .= ' ' . $texts[$i]; } $text .= '...'; } } $content_buffer .= " <div>\n"; $content_buffer .= " " . $text; $content_buffer .= "\t\t</div>\n"; } $content_buffer .= "</li>\n"; } $content_buffer .= " </ul>\n"; $content_buffer .= "\t</td>\n"; $content_buffer .= "</tr>\n"; $content_buffer .= "</table>\n"; } $module->content = $content_buffer; } }
function showCourseLPath($course_id, $lpath_id, &$lpath, &$conds, $option) { global $Itemid, $JLMS_CONFIG; ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; // do field validation if (((pressbutton == 'lpath_item_delete') || (pressbutton == 'lpath_item_edit')) && (form.boxchecked.value == "0")){ alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else { form.task.value = pressbutton; form.submit(); } } function submitbutton_order(pressbutton, item_id) { var form = document.adminForm; if ((pressbutton == 'lpath_item_orderup') || (pressbutton == 'lpath_item_orderdown')){ if (item_id) { form.task.value = pressbutton; form.row_id.value = item_id; form.submit(); } } } /* Ordering (Max) */ function checkAll_button( n ) { for ( var j = 0; j <= n; j++ ) { box = eval( "document.adminForm.cb" + j ); if ( box ) { if ( box.checked == false ) { box.checked = true; } } else { alert("You cannot change the order of items, as an item in the list is `Checked Out`"); return; } } submitform('lpath_item_saveorder'); } var TreeArray1 = new Array(); var TreeArray2 = new Array(); var Is_ex_Array = new Array(); <?php $i = 1; foreach ($lpath as $lpath_row) { echo "TreeArray1[" . $i . "] = " . $lpath_row->parent_id . ";"; echo "TreeArray2[" . $i . "] = " . $lpath_row->id . ";"; echo "Is_ex_Array[" . $i . "] = 1;" . "\n"; $i++; } ?> function Hide_Folder(fid) { var vis_style = 'hidden';var dis_style = 'none';var i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; Hide_Folder(TreeArray2[i]); } i++; } } function Show_Folder(fid) { var vis_style = 'visible';var dis_style = '';var i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; NoChange_Folder(TreeArray2[i]); } i++; } } function NoChange_Folder(fid) { var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { vis_style = 'visible';dis_style = '';j = 1; } i++; } i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; if (j == 1) { NoChange_Folder(TreeArray2[i]); } else { Hide_Folder(TreeArray2[i]); } } i++; } } function Ex_Folder(fid) { var i = 1;var j = 1; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; } i ++; } if (j == 1) { Show_Folder(fid); if (getObj('tree_img_' + fid).runtimeStyle) { var StStr = getObj('tree_img_' + fid).runtimeStyle.filter; var imgStr = getObj('tree_img_' + fid).outerHTML; imgStr = imgStr.replace('chapter_expand.png','chapter_collapse.png').replace('<?php echo _JLMS_LPATH_EXP_CHAP; ?> ', '<?php echo _JLMS_LPATH_COLL_CHAP; ?> '); StStr = StStr.replace('chapter_expand.png','chapter_collapse.png'); getObj('tree_img_' + fid).outerHTML = imgStr; getObj('tree_img_' + fid).runtimeStyle.filter = StStr; } else { getObj('tree_img_' + fid).src = '<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png'; getObj('tree_img_' + fid).alt = '<?php echo _JLMS_LPATH_COLLAPSE; ?> '; getObj('tree_img_' + fid).title = '<?php echo _JLMS_LPATH_COLL_CHAP; ?> '; } } else { Hide_Folder(fid); if (getObj('tree_img_' + fid).runtimeStyle) { var StStr = getObj('tree_img_' + fid).runtimeStyle.filter; var imgStr = getObj('tree_img_' + fid).outerHTML; imgStr = imgStr.replace('chapter_collapse.png','chapter_expand.png').replace('<?php echo _JLMS_LPATH_COLL_CHAP; ?> ', '<?php echo _JLMS_LPATH_EXP_CHAP; ?> '); StStr = StStr.replace('chapter_collapse.png','chapter_expand.png'); getObj('tree_img_' + fid).outerHTML = imgStr; getObj('tree_img_' + fid).runtimeStyle.filter = StStr; } else { getObj('tree_img_' + fid).src = '<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/learnpath/chapter_expand.png'; getObj('tree_img_' + fid).alt = '<?php echo _JLMS_LPATH_EXPAND; ?> '; getObj('tree_img_' + fid).title = '<?php echo _JLMS_LPATH_EXP_CHAP; ?> '; } } i = 1; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) ) { if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0; } else { Is_ex_Array[i] = 1; } } i++; } } JLMS_preloadImages('<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/learnpath/chapter_expand.png','<?php echo $JLMS_CONFIG->getCfg('live_site'); ?> /components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png'); //--> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); JLMS_TMPL::ShowHeader('lpath', _JLMS_LPATH_TITLE_LP, $hparams); $max_tree_width = 0; if (isset($lpath[0])) { $max_tree_width = $lpath[0]->tree_max_width; } JLMS_TMPL::OpenTS(); ?> <form action="<?php echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid; ?> " method="post" name="adminForm"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center">#</<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> width="<?php echo 16 * ($max_tree_width + 1); ?> " class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="<?php echo $max_tree_width + 1; ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="30%"><?php echo _JLMS_LPATH_TBL_HEAD_NAME_LP; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2" width="1"><?php echo _JLMS_REORDER; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"><?php echo _JLMS_ORDER; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> <a class="jlms_img_link" href="javascript:checkAll_button(<?php echo count($lpath) - 1; ?> )"><img width="16" height="16" border="0" title="<?php echo _JLMS_SAVEORDER; ?> " alt="<?php echo _JLMS_SAVEORDER; ?> " src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/filesave.png"/></a> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2" width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="60%"><?php echo _JLMS_LPATH_TBL_HEAD_DESCR_LP; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $tree_modes = array(); for ($i = 0, $n = count($lpath); $i < $n; $i++) { $row_path = $lpath[$i]; $max_tree_width = $row_path->tree_max_width; $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=details_course&id=" . $row_path->id; //ne zabyt' sefRelToAbs $checked = mosHTML::idBox($i, $row_path->id); ?> <tr id="tree_row_<?php echo $row_path->id; ?> " class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center" valign="middle"><?php echo $i + 1; ?> </td> <td valign="middle"><?php if (!isset($row_path->is_link)) { echo $checked; } ?> </td> <?php $add_img = ''; if ($row_path->tree_mode_num) { $g = 0; $tree_modes[$row_path->tree_mode_num - 1] = $row_path->tree_mode; while ($g < $row_path->tree_mode_num - 1) { $pref = ''; if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) { $pref = 'empty_'; } $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='line' border='0' /></td>"; $g++; } $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row_path->tree_mode . ".png\" width='16' height='16' border='0' alt='sub' /></td>"; $max_tree_width = $max_tree_width - $g - 1; } echo $add_img; ?> <td valign="middle" align="center" width="16"><div align="center" style="vertical-align:middle;"><?php switch ($row_path->step_type) { case 1: echo "<span id='tree_div_" . $row_path->id . "' style='text-align:center; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row_path->id . "," . $row_path->id . ",true)'><img id='tree_img_" . $row_path->id . "' class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png\" width='16' height='16' border='0' alt='chapter' /></span>"; break; case 2: if (isset($row_path->folder_flag) && $row_path->folder_flag == 2) { echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/file_zippack.png\" width='16' height='16' border='0' alt='zip package' /></span>"; } else { echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_path->file_icon . ".png\" width='16' height='16' border='0' alt='file' /></span>"; } break; case 3: echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/link_world.png\" width='16' height='16' border='0' alt='link' /></span>"; break; case 4: echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/file_content.png\" width='16' height='16' border='0' alt='content' /></span>"; break; case 5: echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_quiz.png\" width='16' height='16' border='0' alt='quiz' /></span>"; break; case 6: echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_scorm.png\" width='16' height='16' border='0' alt='scorm' /></span>"; break; } ?> </div> </td> <td width="30%" align="left" valign="middle" <?php if ($max_tree_width > 0) { echo "colspan='" . ($max_tree_width + 1) . "'"; } ?> > <?php if ($row_path->step_type == 1) { echo "<strong>" . $row_path->doc_name . "</strong>"; } elseif ($row_path->step_type == 2) { if ($row_path->folder_flag == 2 && $row_path->file_id) { $link_download = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=docs_view_zip&course_id=" . $course_id . "&id=" . $row_path->item_id); echo '<a target="_blank" href="' . $link_download . '" title="' . _JLMS_T_A_VIEW_ZIP_PACK . '">' . $row_path->doc_name . '</a>'; } elseif ((!$row_path->folder_flag || $row_path->folder_flag == 3) && !$row_path->file_id) { if (!isset($row_path->is_link)) { $link_download = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=docs_view_content&course_id=" . $course_id . "&id=" . $row_path->item_id); echo '<a target="_blank" href="' . $link_download . '" title="' . _JLMS_T_A_VIEW_CONTENT . '">' . $row_path->doc_name . '</a>'; } else { echo $row_path->doc_name; } } else { if (!isset($row_path->is_link)) { $link_download = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=get_document&course_id=" . $course_id . "&id=" . $row_path->item_id . "&lpath_id=" . $lpath_id); echo '<a href="' . $link_download . '" title="' . _JLMS_T_A_DOWNLOAD . '">' . $row_path->doc_name . '</a>'; } else { echo $row_path->doc_name; } } } elseif ($row_path->step_type == 3) { echo '<a target="_blank" href="' . $row_path->link_href . '" title="' . _JLMS_T_A_VIEW_LINK . '">' . $row_path->doc_name . '</a>'; } elseif ($row_path->step_type == 4) { echo '<a href="' . sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=show_lp_content&course_id=" . $course_id . "&lpath_id=" . $row_path->lpath_id . "&id=" . $row_path->id) . '" title="' . _JLMS_T_A_VIEW_CONTENT . '">' . $row_path->doc_name . '</a>'; } else { echo $row_path->doc_name; } ?> </td> <td valign="middle" style="vertical-align:middle;"><?php if ($row_path->allow_up == 1) { echo JLMS_orderUpIcon(1, $row_path->id, true, 'lpath_item_orderup'); } else { echo ' '; } ?> </td> <td valign="middle" style="vertical-align:middle;"><?php if ($row_path->allow_down == 1) { echo JLMS_orderDownIcon(1, 3, $row_path->id, true, 'lpath_item_orderdown'); } else { echo ' '; } ?> </td> <td valign="middle" style="vertical-align:middle;" colspan="2"> <?php // if ($row_path->step_type != 1) { ?> <input type="text" name="order[]" size="5" value="<?php echo $row_path->ordering; ?> " class="inputbox" style="text-align: center" /> <?php // } ?> </td> <td valign="middle" style="vertical-align:middle "> <?php if ($row_path->step_type == 1) { ?> <a class="jlms_img_link" href="<?php echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=add_lpath_step&course_id=" . $row_path->course_id . "&id=" . $row_path->lpath_id . "&parent=" . $row_path->id; ?> " title="<?php echo _JLMS_LPATH_LINK_ADDSTEP_TITLE; ?> "><img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_add.png" width="16" height="16" border="0" alt="<?php echo _JLMS_LPATH_LINK_ADDSTEP_TITLE; ?> " title="<?php echo _JLMS_LPATH_LINK_ADDSTEP_TITLE; ?> " /></a> <?php } else { echo ' '; } ?> </td> <td valign="middle" style="vertical-align:middle "> <?php $cond_link = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=lpath_step_cond&course_id={$course_id}&lpath_id={$lpath_id}&id={$row_path->id}"); $cond_descr = _JLMS_LPATH_FLWINDOW_NOCOND; $cond_title = _JLMS_LPATH_TITLE_FLWINDOW; $cond_img = 'btn_warning'; if ($row_path->is_condition) { $cond_img = 'btn_cond_present'; $y = 0; $is_cond_descr = false; $cond_descr = '<table cellpadding=0 cellspacing=0 border=0>'; while ($y < count($conds)) { if ($conds[$y]->step_id == $row_path->id) { $ref_name = ''; $u = 0; while ($u < count($lpath)) { if ($lpath[$u]->id == $conds[$y]->ref_step) { $ref_name = $lpath[$u]->step_name; break; } $u++; } if (isset($conds[$y]->cond_time) && $conds[$y]->cond_time) { $ref_name .= ' (' . _JLMS_LPATH_CONDTYPE_SPENT . ' ' . $conds[$y]->cond_time . ' ' . _JLMS_LPATH_CONDTYPE_TIME_SPENT_MIN . ')'; } $cond_descr .= '<tr><td>' . _JLMS_LPATH_CONDTYPE_COMPLETE_W . ' </td><td>' . $ref_name . '</td></tr>'; $is_cond_descr = true; } $y++; } $cond_descr .= '</table>'; if (!$is_cond_descr) { $cond_descr = _JLMS_LPATH_FLWINDOW_NOCOND; } } $img_inside_tag = '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $cond_img . '.png" width="16" height="16" border="0" alt="cond" />'; echo JLMS_toolTip($cond_title, JLMS_txt2overlib($cond_descr), $img_inside_tag, $cond_link); ?> </td> <td width="60%" valign="middle" style="vertical-align:middle; "><?php echo strlen($row_path->step_shortdescription) ? $row_path->step_shortdescription : ' '; ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="lpath_add_chapter" /> <input type="hidden" name="id" value="<?php echo $lpath_id; ?> " /> <input type="hidden" name="course_id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="row_id" value="0" /> <input type="hidden" name="boxchecked" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); $link_new = ampReplace(sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=new_lpath_chapter&id=" . $lpath_id . "&course_id=" . $course_id)); $controls = array(); //$controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_LPATH_LINK_NEW_CHAP, 'img' => 'add'); $controls[] = array('href' => "javascript:submitbutton('add_lpath_step');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_ADDSTEP_TITLE, 'img' => 'add'); $controls[] = array('href' => "javascript:submitbutton('lpath_item_delete');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_DEL_ITEM, 'img' => 'delete'); $controls[] = array('href' => "javascript:submitbutton('lpath_item_edit');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_EDIT_ITEM, 'img' => 'edit'); //$controls[] = array('href' => "spacer"); JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=learnpaths&id=" . $course_id)); JLMS_TMPL::CloseMT(); }
function echoMyNotices($option, $Itemid, $my_notices) { global $Itemid, $JLMS_CONFIG; $link_base = 'index.php?option=com_joomla_lms&Itemid=' . $Itemid; $link_notices = $link_base; $link_notices .= '&task=view_all_notices'; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist', 'jlms_homepage_list'); ?> " style="margin-top:0; margin-bottom:0;"> <tr><<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2" align="center" style="text-align:center"><?php echo _JLMS_HOME_NOTICES; ?> </<?php echo JLMSCSS::tableheadertag(); ?> ></tr> <?php $k = 1; foreach ($my_notices as $m_n) { $link = $link_base; if ($m_n->doc_id) { $link .= '&task=' . $m_n->task . '&course_id=' . $m_n->course_id . '&id=' . $m_n->doc_id . ''; } else { $link .= '&task=' . $m_n->task . '&id=' . $m_n->course_id . ''; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="top" width="16" style="padding-top: 5px;"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/btn_notice.png"; ?> " width="16" height="16" border="0" alt="dropbox" /> </td> <td> <div class="notes_head"> on <?php echo JLMS_dateToDisplay($m_n->data, false, 0, " H:m:s"); ?> </div> <div class="clr"></div> <div class="notes_foot"> <?php if (!$m_n->course_id && !$m_n->doc_id) { if (strlen($m_n->notice) > 100) { echo substr($m_n->notice, 0, 100) . ' ...'; } else { echo substr($m_n->notice, 0, 100); } } else { ?> <a href="<?php echo ampReplace(sefRelToAbs($link)); ?> " title="<?php echo substr($m_n->notice, 0, 30); ?> "> <?php if (strlen($m_n->notice) > 100) { echo substr($m_n->notice, 0, 100) . ' ...'; } else { echo substr($m_n->notice, 0, 100); } ?> </a> <?php } ?> </div> </td> </tr> <?php $k = 3 - $k; } ?> <tr> <td colspan="2" align="right" class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> "> <a href="<?php echo sefRelToAbs($link_notices); ?> " title="view all notices" style="font-size: 9px;"> view all notes </a> </td> </tr> </table> <?php }
function editCategory(&$menu, &$lists, &$params, $option) { global $mosConfig_live_site; ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { if ( pressbutton == 'cancel' ) { submitform( pressbutton ); return; } var form = document.adminForm; <?php if (!$menu->id) { ?> if ( getSelectedValue( 'adminForm', 'componentid' ) < 1 ) { alert( 'You must select a category' ); return; } cat = getSelectedText( 'adminForm', 'componentid' ); form.link.value = "index.php?option=com_newsfeeds&catid=" + form.componentid.value; if ( form.name.value == '' ) { form.name.value = cat; } submitform( pressbutton ); <?php } else { ?> if ( form.name.value == '' ) { alert( 'This Menu item must have a title' ); } else { submitform( pressbutton ); } <?php } ?> } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Edit' : 'Add'; ?> Menu Item :: Table - News Feed Category </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="3"> Details </th> </tr> <tr> <td width="10%" align="right" valign="top"> Name: </td> <td width="200px"> <input type="text" name="name" size="30" maxlength="100" class="inputbox" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> "/> </td> <td> <?php if (!$menu->id) { echo mosToolTip('If you leave this blank the Category name will be automatically used'); } ?> </td> </tr> <tr> <td width="10%" align="right" valign="top"> Category: </td> <td colspan="2"> <?php echo $lists['componentid']; ?> </td> </tr> <tr> <td align="right"> URL: </td> <td colspan="2"> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td align="right"> Parent Item: </td> <td colspan="2"> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right"> Ordering: </td> <td colspan="2"> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right"> Access Level: </td> <td colspan="2"> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right"> Published: </td> <td colspan="2"> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parameters </th> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="link" value="<?php echo $menu->link; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <?php }
public static function showNewsfeeds(&$newsfeed, $LitePath, $cacheDir, &$params) { ?> <table width="100%" class="contentpane<?php echo $params->get('pageclass_sfx'); ?> "> <?php if ($params->get('header')) { ?> <tr> <td class="componentheading<?php echo $params->get('pageclass_sfx'); ?> " colspan="2"> <?php echo $params->get('header'); ?> </td> </tr> <?php } // full RSS parser used to access image information $rssDoc = new xml_domit_rss_document(); $rssDoc->setRSSTimeout(5); $rssDoc->useCacheLite(true, $LitePath, $cacheDir, $newsfeed->cache_time); $success = $rssDoc->loadRSS($newsfeed->link); if ($success) { $totalChannels = $rssDoc->getChannelCount(); for ($i = 0; $i < $totalChannels; $i++) { $currChannel =& $rssDoc->getChannel($i); $elements = $currChannel->getElementList(); $descrip = 0; $iUrl = 0; foreach ($elements as $element) { //image handling if ($element == 'image') { $image =& $currChannel->getElement(DOMIT_RSS_ELEMENT_IMAGE); $iUrl = $image->getUrl(); $iTitle = $image->getTitle(); } if ($element == 'description') { $descrip = 1; // hide com_rss descrip in 4.5.0 feeds if ($currChannel->getDescription() == 'com_rss') { $descrip = 0; } } } $feed_title = $currChannel->getTitle(); $feed_title = mosCommonHTML::newsfeedEncoding($rssDoc, $feed_title); ?> <tr> <td class="contentheading<?php echo $params->get('pageclass_sfx'); ?> "> <a href="<?php echo ampReplace($currChannel->getLink()); ?> " target="_blank"> <?php echo $feed_title; ?> </a> </td> </tr> <?php // feed description if ($descrip && $params->get('feed_descr')) { $feed_descrip = $currChannel->getDescription(); $feed_descrip = mosCommonHTML::newsfeedEncoding($rssDoc, $feed_descrip); ?> <tr> <td> <?php echo $feed_descrip; ?> <br /> <br /> </td> </tr> <?php } // feed image if ($iUrl && $params->get('feed_image')) { ?> <tr> <td> <img src="<?php echo $iUrl; ?> " alt="<?php echo $iTitle; ?> " /> </td> </tr> <?php } $actualItems = $currChannel->getItemCount(); $setItems = $newsfeed->numarticles; if ($setItems > $actualItems) { $totalItems = $actualItems; } else { $totalItems = $setItems; } ?> <tr> <td> <ul> <?php for ($j = 0; $j < $totalItems; $j++) { $currItem =& $currChannel->getItem($j); $item_title = $currItem->getTitle(); $item_title = mosCommonHTML::newsfeedEncoding($rssDoc, $item_title); ?> <li> <?php // START fix for RSS enclosure tag url not showing if ($currItem->getLink()) { ?> <a href="<?php echo ampReplace($currItem->getLink()); ?> " target="_blank"> <?php echo $item_title; ?> </a> <?php } else { if ($currItem->getEnclosure()) { $enclosure = $currItem->getEnclosure(); $eUrl = $enclosure->getUrl(); ?> <a href="<?php echo ampReplace($eUrl); ?> " target="_blank"> <?php echo $item_title; ?> </a> <?php } else { if ($currItem->getEnclosure() && $currItem->getLink()) { $enclosure = $currItem->getEnclosure(); $eUrl = $enclosure->getUrl(); ?> <a href="<?php echo ampReplace($currItem->getLink()); ?> " target="_blank"> <?php echo $item_title; ?> </a> <br /> Link: <a href="<?php echo $eUrl; ?> " target="_blank"> <?php echo ampReplace($eUrl); ?> </a> <?php } } } // END fix for RSS enclosure tag url not showing // item description if ($params->get('item_descr')) { $text = $currItem->getDescription(); $text = mosCommonHTML::newsfeedEncoding($rssDoc, $text); $num = $params->get('word_count'); // word limit check if ($num) { $texts = explode(' ', $text); $count = count($texts); if ($count > $num) { $text = ''; for ($i = 0; $i < $num; $i++) { $text .= ' ' . $texts[$i]; } $text .= '...'; } } ?> <br /> <?php echo $text; ?> <br /> <br /> <?php } ?> </li> <?php } ?> </ul> </td> </tr> <tr> <td> <br /> </td> </tr> <?php } } ?> </table> <?php // displays back button mosHTML::BackButton($params); }
function edit(&$menu, &$lists, &$params, $option) { global $mosConfig_live_site; ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { if ( pressbutton == 'cancel' ) { submitform( pressbutton ); return; } var form = document.adminForm; if ( form.name.value == "" ) { alert( 'Este item de menu deve possuir um título' ); } else { <?php if (!$menu->id) { ?> if ( form.url.value == "" ){ alert( "Você deve informar uma url." ); } else { submitform( pressbutton ); } <?php } else { ?> submitform( pressbutton ); <?php } ?> } } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Editar' : 'Adicionar'; ?> Wrapper </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="2"> Detalhes </th> </tr> <tr> <td width="10%" align="right" valign="top"> Nome: </td> <td width="200px"> <input type="text" name="name" size="30" maxlength="100" class="inputbox" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> "/> </td> </tr> <tr> <td width="20%" align="right"> Link Wrapper: </td> <td width="80%"> <input class="inputbox" type="text" name="url" size="50" maxlength="250" value="<?php echo @$menu->url; ?> " /> </td> </tr> <tr> <td width="10%" align="right"> Url: </td> <td width="80%"> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td align="right"> Nível do Item: </td> <td colspan="2"> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right"> Ordenação: </td> <td colspan="2"> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right"> Nível de Acesso: </td> <td colspan="2"> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right"> Publicado: </td> <td colspan="2"> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parâmetros </th> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="link" value="<?php echo $menu->link; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <?php }
/** * Display Table of items */ function showTable(&$params, &$rows, $catid, $tabclass) { global $mosConfig_live_site; // icon in table display if ($params->get('weblink_icons') != -1) { $img = mosAdminMenus::ImageCheck('weblink.png', '/images/M_images/', $params->get('weblink_icons'), '/images/M_images/', 'Link', 'Link'); } else { $img = NULL; } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php if ($params->get('headings')) { ?> <tr> <?php if ($img) { ?> <td class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> "> </td> <?php } ?> <td width="90%" height="20" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo _HEADER_TITLE_WEBLINKS; ?> </td> <?php if ($params->get('hits')) { ?> <td width="30" height="20" class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?> " align="right"> <?php echo _HEADER_HITS; ?> </td> <?php } ?> </tr> <?php } $k = 0; foreach ($rows as $row) { $iparams = new mosParameters($row->params); $link = sefRelToAbs('index.php?option=com_weblinks&task=view&catid=' . $catid . '&id=' . $row->id); $link = ampReplace($link); $menuclass = 'category' . $params->get('pageclass_sfx'); switch ($iparams->get('target')) { // cases are slightly different case 1: // open in a new window $txt = '<a href="' . $link . '" target="_blank" class="' . $menuclass . '">' . $row->title . '</a>'; break; case 2: // open in a popup window $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\">" . $row->title . "</a>\n"; break; default: // formerly case 2 // open in parent window $txt = '<a href="' . $link . '" class="' . $menuclass . '">' . $row->title . '</a>'; break; } ?> <tr class="<?php echo $tabclass[$k]; ?> "> <?php if ($img) { ?> <td width="100" height="20" align="center"> <?php echo $img; ?> </td> <?php } ?> <td height="20"> <?php echo $txt; ?> <?php if ($params->get('item_description')) { ?> <br /> <?php echo $row->description; ?> <?php } ?> </td> <?php if ($params->get('hits')) { ?> <td align="center"> <?php echo $row->hits; ?> </td> <?php } ?> </tr> <?php $k = 1 - $k; } ?> </table> <?php }
function menuLink($id) { global $database; josSpoofCheck(); $section = new mosSection($database); $section->bind($_POST); $section->checkin(); $menu = strval(mosGetParam($_POST, 'menuselect', '')); $name = strval(mosGetParam($_POST, 'link_name', '')); $type = strval(mosGetParam($_POST, 'link_type', '')); $name = stripslashes(ampReplace($name)); switch ($type) { case 'content_section': $link = 'index.php?option=com_content&task=section&id=' . $id; $menutype = 'Section Table'; break; case 'content_blog_section': $link = 'index.php?option=com_content&task=blogsection&id=' . $id; $menutype = 'Section Blog'; break; case 'content_archive_section': $link = 'index.php?option=com_content&task=archivesection&id=' . $id; $menutype = 'Section Blog Archive'; break; } $row = new mosMenu($database); $row->menutype = $menu; $row->name = $name; $row->type = $type; $row->published = 1; $row->componentid = $id; $row->link = $link; $row->ordering = 9999; if ($type == 'content_blog_section') { $row->params = 'sectionid=' . $id; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype = " . $database->Quote($menu)); // clean any existing cache files mosCache::cleanCache('com_content'); $msg = $name . ' ( ' . $menutype . ' ) in menu: ' . $menu . ' successfully created'; mosRedirect('index2.php?option=com_sections&scope=content&task=editA&hidemainmenu=1&id=' . $id, $msg); }
function editCategory(&$menu, &$lists, &$params, $option) { global $mosConfig_live_site; ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { if (pressbutton == 'cancel') { submitform( pressbutton ); return; } var form = document.adminForm; <?php if (!$menu->id) { ?> if ( getSelectedValue( 'adminForm', 'componentid' ) < 1 ) { alert( 'Você deve selecionar uma categoria' ); return; } sectcat = getSelectedText( 'adminForm', 'componentid' ); sectcats = sectcat.split('/'); section = getSelectedOption( 'adminForm', 'componentid' ); form.link.value = "index.php?option=com_content&task=archivecategory&id=" + form.componentid.value; if ( form.name.value == '' ) { form.name.value = sectcats[1]; } submitform( pressbutton ); <?php } else { ?> if ( form.name.value == '' ) { alert( 'Este item de menu deve possuir um título' ); } else { submitform( pressbutton ); } <?php } ?> } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Editar' : 'Adicionar'; ?> Blog - Arquivo de Conteúdo da Categoria </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="3"> Detalhes </th> </tr> <tr> <td width="10%" align="right" valign="top">Nome:</td> <td width="200px"> <input type="text" name="name" size="30" maxlength="100" class="inputbox" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> "/> </td> <td> <?php if (!$menu->id) { echo mosToolTip('Se você deixar este em branco o nome da categoria será automaticamente usado'); } ?> </td> </tr> <tr> <td valign="top" align="right">Categoria:</td> <td> <?php echo $lists['componentid']; ?> </td> </tr> <tr> <td align="right">Url:</td> <td> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td align="right">Nível do Item:</td> <td> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right">Ordenação:</td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right">Nível de Acesso:</td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right">Publicado:</td> <td> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parâmetros </th> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <?php }
/** * Utility function for writing a menu link * (modification of the original menu module mosGetMenuLink function) */ function mosGetMenuLink($menuNode, $level = 0, &$params, $itemHierarchy) { global $Itemid, $mainframe; // only used if it is not Joomla 1.5+ $siteHelper =& $this->getSiteHelper(); $menuItemParametersString = isset($menuNode->params) ? $menuNode->params : ''; $menuItemParameters = FALSE; $txt = ''; $gotFinalLink = FALSE; switch ($menuNode->type) { case 'separator': $menuNode->browserNav = 3; break; case 'component_item_link': break; case 'content_item_link': if (!$this->hasItemid($menuNode->link)) { $temp = split('&task=view&id=', $menuNode->link); if (count($temp) != 2) { $temp = split('&view=article&id=', $menuNode->link); } if (($this->callGetItemid || $menuNode->id === FALSE) && count($temp) == 2) { $contentId = $temp[1]; if (function_exists('jimport')) { require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php'; $menuNode->link = ContentHelperRoute::getArticleRoute($contentId, $menuNode->getCategoryId(), $menuNode->getSectionId()); $gotFinalLink = FALSE; $id = FALSE; } else { if ($menuNode->id !== FALSE) { $_Itemid = $Itemid; $Itemid = $menuNode->id; // getItemid uses the global variable as a default value... use the id of the menu item instead $id = $mainframe->getItemid($temp[1]); $Itemid = $_Itemid; } else { $id = $mainframe->getItemid($temp[1]); } } } else { $id = $menuNode->id; } if ($id > 0) { $menuNode->link .= '&Itemid=' . $id; } } break; case 'url': switch ($this->addUrlItemidMode) { case 'local': $rootUri = $siteHelper->getUri(); if (strpos(strtolower($menuNode->link), 'index.php?') !== FALSE && ($rootUri == '' || strpos($menuNode->link, ':') === FALSE || strpos($menuNode->link, $rootUri) === 0)) { $menuNode->link = $this->addItemid($menuNode->link, $menuNode->id); } break; case 'default': default: if (strpos(strtolower($menuNode->link), 'index.php?') !== FALSE) { $menuNode->link = $this->addItemid($menuNode->link, $menuNode->id); } } break; case 'content_typed': default: $menuNode->link = $this->addItemid($menuNode->link, $menuNode->id); break; } // Active Menu highlighting // why reading the request parameter when there is a global variable? // $current_itemid = trim( mosGetParam( $_REQUEST, 'Itemid', 0 ) ); $title = strip_tags($menuNode->name); // use a more meaningful name than "id": elementParameters $elementParameters = ''; if ($this->hierarchyBasedIds && count($itemHierarchy) > 0) { $elementParameters .= ' id="menulink_' . $this->getHierarchyString($itemHierarchy) . $this->idSuffix . '"'; } else { if ($menuNode->isCurrent()) { $elementParameters .= ' id="active_menu' . $this->idSuffix . '"'; } } if (isset($menuNode->accessKey) && $menuNode->accessKey != '') { $elementParameters .= ' accesskey="' . $menuNode->accessKey . '"'; $title .= ' [' . strtoupper($menuNode->accessKey) . ']'; } if ($this->titleAttribute) { $elementParameters .= ' title="' . $title . '"'; } if (!$gotFinalLink) { $shouldSefLink = strcasecmp(substr($menuNode->link, 0, 4), 'http') != 0 && strcasecmp(substr($menuNode->link, 0, 1), '#') != 0; if (class_exists('JRoute')) { if ($shouldSefLink) { if (!is_object($menuItemParameters)) { $menuItemParameters =& $this->getParsedParameters($menuItemParametersString); } $secure = $menuItemParameters->def('secure', 0); $menuNode->link = JRoute::_($menuNode->link, true, $secure); } else { $menuNode->link = ampReplace($menuNode->link); } } else { $menuNode->link = ampReplace($menuNode->link); if ($shouldSefLink) { // no secure link support for older versions $menuNode->link = sefRelToAbs($menuNode->link); } } } $menuclass = $this->getLinkMenuClassName($menuNode, $level); $linkBegin = ''; $linkText = $menuNode->name; $linkEnd = ''; switch ($menuNode->browserNav) { // cases are slightly different case 1: // open in a new window $linkBegin = '<a href="' . $menuNode->link . '" target="_blank" class="' . $menuclass . '"' . $elementParameters . '>'; $linkEnd = '</a>'; // $txt = '<a href="'. $menuNode->link .'" target="_blank" class="'. $menuclass .'"'. $elementParameters .'>'. $menuNode->name .'</a>'; break; case 2: // open in a popup window $linkBegin = "<a href=\"#\" onclick=\"javascript: window.open('" . $menuNode->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\"" . $elementParameters . ">"; $linkEnd = "</a>\n"; // $txt = "<a href=\"#\" onclick=\"javascript: window.open('". $menuNode->link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\"". $elementParameters .">". $menuNode->name ."</a>\n"; break; case 3: // don't link it $linkBegin = '<span class="' . $menuclass . '"' . $elementParameters . '>'; $linkText = $menuNode->name != '' ? $menuNode->name : ' '; $linkEnd = '</span>'; // $txt = '<span class="'. $menuclass .'"'. $elementParameters .'>'. ($menuNode->name != '' ? $menuNode->name : ' ') .'</span>'; break; default: // formerly case 2 // open in parent window $linkBegin = '<a href="' . $menuNode->link . '" class="' . $menuclass . '"' . $elementParameters . '>'; $linkEnd = '</a>'; // $txt = '<a href="'. $menuNode->link .'" class="'. $menuclass .'"'. $elementParameters .'>'. $menuNode->name .'</a>'; break; } $txt = $linkBegin . $linkText . $linkEnd; if ($this->imageEnabled) { if (!is_object($menuItemParameters)) { $menuItemParameters =& $this->getParsedParameters($menuItemParametersString); } $menu_image = $menuItemParameters->def('menu_image', -1); if ($menu_image != '-1' && $menu_image) { $image = '<img src="' . $siteHelper->getUri('images/stories/' . $menu_image) . '" border="0" alt="' . $menuNode->name . '"/>'; switch ($this->imageAlignment) { case 'image_only': // does not really make sense $txt = $image; break; case 'image_only_linked': $txt = $linkBegin . $image . $linkEnd; break; case 'right': $txt = $txt . ' ' . $image; break; case 'right_linked': $txt = $linkBegin . $linkText . ' ' . $image . $linkEnd; break; case 'left_linked': $txt = $linkBegin . $image . ' ' . $linkText . $linkEnd; break; case 'left': default: $txt = $image . ' ' . $txt; } } } $this->lastLinkBegin = $linkBegin; $this->lastLinkEnd = $linkEnd; return $txt; }
function edit(&$menu, &$lists, &$params, $option, $newsfeed) { global $mosConfig_live_site; ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } // do field validation if (trim(form.name.value) == ""){ alert( "Link deve possuir um nome" ); } else if (trim(form.newsfeed_link.value) == ""){ alert( "Você deve selecionar um notícia externa para linkar" ); } else { form.link.value = "index.php?option=com_newsfeeds&task=view&feedid=" + form.newsfeed_link.value; form.componentid.value = form.newsfeed_link.value; submitform( pressbutton ); } } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Editar' : 'Adicionar'; ?> Link - Notícias Externas </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="2"> Detalhes </th> </tr> <tr> <td width="10%" align="right"> Nome: </td> <td width="80%"> <input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> " /> </td> </tr> <tr> <td width="10%" align="right" valign="top"> Notícia Externa para Linkar: </td> <td width="80%"> <?php echo $lists['newsfeed']; ?> </td> </tr> <tr> <td width="10%" align="right">Url:</td> <td width="80%"> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td width="10%" align="right" valign="top"> Ao clicar, abrir em: </td> <td width="80%"> <?php echo $lists['target']; ?> </td> </tr> <tr> <td align="right"> Nível do Item: </td> <td> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right"> Ordenação: </td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right"> Nível de Acesso: </td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right">Publicado:</td> <td> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parâmetros </th> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="componentid" value="" /> <input type="hidden" name="link" value="" /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <?php }
function JLMS_saveDropBox($option) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); $_JLMS_PLUGINS =& JLMSFactory::getPlugins(); $db =& JFactory::getDbo(); $user = JLMSFactory::getUser(); $course_id = intval(mosGetParam($_REQUEST, 'course_id', 0)); // if ($user->get('id') && $course_id && JLMS_GetUserType($user->get('id'), $course_id) ) { $JLMS_ACL =& JLMSFactory::getACL(); if ($user->get('id') && $course_id && $JLMS_ACL->CheckPermissions('dropbox', 'view')) { $recv_id = intval(mosGetParam($_REQUEST, 'recv_id', 0)); $recv_id = mosGetParam($_POST, 'recv_id', array(0)); if (!is_array($recv_id)) { $recv_id = array(0); } if (isset($recv_id[0]) && !$recv_id[0] || !count($recv_id)) { //fix one user (ticket [QDHZ-1096]) $msg = _JLMS_DROP_ERROR_NO_SEND_TO; JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"), $msg); } //convert array of receiver's to numeric values $i = 0; while ($i < count($recv_id)) { $recv_id[$i] = intval($recv_id[$i]); $i++; } $recv_ids = implode(',', $recv_id); $do_continue = false; /* New permissions (Max) */ $query = "SELECT count(user_id) FROM #__lms_user_courses" . "\n WHERE course_id = '" . $course_id . "' AND user_id IN ( {$recv_ids} )"; $db->setQuery($query); $count_users = $db->LoadResult(); if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers')) { if ($count_users) { $do_continue = true; } else { $query = "SELECT count(c.user_id) FROM #__lms_users_in_groups as c" . "\n WHERE c.course_id = '" . $course_id . "' AND c.user_id IN ( {$recv_ids} )"; $db->setQuery($query); $count_users = $db->LoadResult(); if ($count_users) { $do_continue = true; } } } if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners')) { if ($count_users) { $do_continue = true; } } /* Old part */ /* if (JLMS_GetUserType($user->get('id'), $course_id) == 1) { $query = "SELECT count(user_id) FROM #__lms_user_courses" . "\n WHERE course_id = '".$course_id."' AND (role_id = 1 OR role_id = 4) AND user_id IN ( $recv_ids )"; $db->setQuery($query); $count_users = $db->LoadResult(); if ($count_users) { $do_continue = true; } else { $query = "SELECT count(c.user_id) FROM #__lms_users_in_groups as c" . "\n WHERE c.course_id = '".$course_id."' AND c.user_id IN ( $recv_ids )"; $db->setQuery($query); $count_users = $db->LoadResult(); if ($count_users) { $do_continue = true; } } } elseif (JLMS_GetUserType($user->get('id'), $course_id) == 2) { $query = "SELECT count(user_id) FROM #__lms_user_courses" . "\n WHERE course_id = '".$course_id."' AND (role_id = 1 OR role_id = 4) AND user_id IN ( $recv_ids )"; $db->setQuery($query); $count_users = $db->LoadResult(); if ($count_users) { $do_continue = true; } } */ // (TIPS) // sender: teacher - RECEIVER must be teacher of this course or student of this course // sender: student - RECEIVER must be teacher of this course $flag = false; if ($do_continue) { if ($_FILES['userfile']['name'] == '') { $file_id = 0; $flag = true; } else { $file_id = JLMS_uploadFile($course_id); if ($file_id) { $flag = true; } } $_POST['drp_type'] = 1; if (intval(mosGetParam($_REQUEST, 'file_id', 0))) { $file_id = intval(mosGetParam($_REQUEST, 'file_id', 0)); $_POST['drp_type'] = 2; } if ($flag) { $row = new mos_Joomla_LMS_DropBox($db); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->file_id = $file_id; $row->owner_id = $user->get('id'); $row->drp_mark = 1; /*$query = "SELECT file_name FROM #__lms_files WHERE id = '".$file_id."'"; $db->SetQuery( $query ); $row->drp_name = $db->LoadResult();*/ //$row->drp_name = strval(mosGetParam($_FILES['userfile'], 'name', 'dropbox_file')); if ($file_id > 0) { if ($row->drp_type == 1) { $drp_name = isset($_FILES['userfile']['name']) ? strval($_FILES['userfile']['name']) : 'dropbox_file'; } else { if ($row->drp_type == 2) { $drp_name = strval(mosGetParam($_REQUEST, 'dropbox_name', 'dropbox_file_(' . time() . ')')); } } } else { $drp_name = mosGetParam($_REQUEST, 'dropbox_name'); } $drp_name = get_magic_quotes_gpc() ? stripslashes($drp_name) : $drp_name; $row->drp_name = ampReplace(strip_tags($drp_name)); $row->drp_description = strval(JLMS_getParam_LowFilter($_POST, 'drp_description', '')); //$row->drp_description = JLMS_ProcessText_LowFilter($row->drp_description); // if (JLMS_GetUserType($user->get('id'), $course_id ) == 1) { if ($JLMS_ACL->CheckPermissions('dropbox', 'mark_as_corrected')) { $drp_corr = intval(mosGetParam($_REQUEST, 'drp_corrected', 0)); if ($drp_corr != 1) { $drp_corr = 0; } $row->drp_corrected = $drp_corr; } else { $row->drp_corrected = 0; } $row->drp_time = date('Y-m-d H:i:s'); //Replace old function JLMS_GetUserType //tmp $users_teachers = array(); $users_learners = array(); if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers')) { $query = "SELECT a.* FROM #__users as a, #__lms_user_courses as c" . "\n WHERE a.id = c.user_id AND c.course_id = '" . $course_id . "' AND a.id <> '" . $user->id . "'" . "\n ORDER BY a.username"; $db->SetQuery($query); $users_teachers = $db->LoadObjectList(); $i = 0; while ($i < count($users_teachers)) { $users_teachers[$i]->username = _JLMS_ROLE_TEACHER . ' - ' . $users_teachers[$i]->name . ' (' . $users_teachers[$i]->username . ')'; $i++; } } if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners')) { $users_learners = JLMS_getCourseStudentsList($course_id); } $tmp = array(); foreach ($users_teachers as $n => $ut) { $tmp[$n] = $ut->id; } if (count($tmp)) { $users_teachers = $tmp; } $tmp = array(); foreach ($users_learners as $n => $ul) { $tmp[$n] = $ul->id; } if (count($tmp)) { $users_learners = $tmp; } //Replace old function JLMS_GetUserType //tmp foreach ($recv_id as $recv) { $check_recv = false; //Replace old function JLMS_GetUserType //tmp if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers') && in_array($recv, $users_teachers)) { $check_recv = true; } if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners') && in_array($recv, $users_learners)) { $check_recv = true; } //Replace old function JLMS_GetUserType //tmp // if ($recv && ($recv != $user->get('id')) && ((JLMS_GetUserType($user->get('id'), $course_id) == 1 && JLMS_GetUserType($recv, $course_id)) || ((JLMS_GetUserType($user->get('id'), $course_id) == 2) && (JLMS_GetUserType($recv, $course_id, true) == 1))) || ((JLMS_GetUserType($user->get('id'), $course_id) == 2) && (JLMS_GetUserType($recv, $course_id, true) == 2)) ) { //old if ($recv && $recv != $user->get('id') && $check_recv) { $row->id = 0; $row->recv_id = $recv; if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } //*** send email notification $e_course = new stdClass(); $e_course->course_alias = ''; $e_course->course_name = ''; $query = "SELECT course_name, name_alias FROM #__lms_courses WHERE id = '" . $course_id . "'"; $db->setQuery($query); $e_course = $db->loadObject(); $e_user = new stdClass(); $e_user->name = ''; $e_user->email = ''; $e_user->username = ''; $query = "SELECT email, name, username FROM #__users WHERE id = '" . $recv . "'"; $db->setQuery($query); $e_user = $db->loadObject(); $e_params['user_id'] = $recv; $e_params['course_id'] = $course_id; $e_params['markers']['{email}'] = $e_user->email; $e_params['markers']['{name}'] = $e_user->name; $e_params['markers']['{username}'] = $e_user->username; $e_params['markers']['{coursename}'] = $e_course->course_name; //( $e_course->course_alias )?$e_course->course_alias:$e_course->course_name; $e_params['markers']['{filename}'] = $row->drp_name; $e_params['markers']['{courselink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}&task=details_course&id={$course_id}"); $e_params['markers_nohtml']['{courselink}'] = $e_params['markers']['{courselink}']; $e_params['markers']['{courselink}'] = '<a href="' . $e_params['markers']['{courselink}'] . '">' . $e_params['markers']['{courselink}'] . '</a>'; $e_params['markers']['{lmslink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}"); $e_params['markers_nohtml']['{lmslink}'] = $e_params['markers']['{lmslink}']; $e_params['markers']['{lmslink}'] = '<a href="' . $e_params['markers']['{lmslink}'] . '">' . $e_params['markers']['{lmslink}'] . '</a>'; $e_params['action_name'] = 'OnNewDropboxFile'; $_JLMS_PLUGINS->loadBotGroup('emails'); $plugin_result_array = $_JLMS_PLUGINS->trigger('OnNewDropboxFile', array(&$e_params)); //*** end of emails } } JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}")); } else { mosErrorAlert("Upload of " . $userfile_name . " failed"); } } else { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}")); } } else { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}")); } }
public static function edit(&$menu, &$lists, &$params, $option, $content) { global $mosConfig_live_site; ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } if (pressbutton == 'redirect') { submitform( pressbutton ); return; } // do field validation if (trim(form.name.value) == ""){ alert( "Link must have a name" ); } else if (trim(form.content_typed.value) == ""){ alert( "You must select a Content to link to" ); } else { form.link.value = "index.php?option=com_content&task=view&id=" + form.content_typed.value; form.componentid.value = form.content_typed.value; submitform( pressbutton ); } } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Edit' : 'Add'; ?> Menu Item :: Link - Static Content </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="2"> Details </th> </tr> <tr> <td width="10%" align="right"> Name: </td> <td width="80%"> <input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> " /> </td> </tr> <tr> <td width="10%" align="right" valign="top"> Static Content: </td> <td width="80%"> <?php echo $lists['content']; ?> </td> </tr> <tr> <td width="10%" align="right">URL:</td> <td width="80%"> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td width="10%" align="right" valign="top"> On Click, open: </td> <td width="80%"> <?php echo $lists['target']; ?> </td> </tr> <tr> <td align="right"> Parent Item: </td> <td> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right"> Ordering: </td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right"> Access Level: </td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right">Published:</td> <td> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parameters </th> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="scid" value="<?php echo $menu->componentid; ?> " /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="link" value="" /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="componentid" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <?php }
/** * Save the configuration */ function saveconfig($task) { global $database, $mosConfig_absolute_path, $mosConfig_password, $mosConfig_session_type; josSpoofCheck(); $row = new mosConfig(); if (!$row->bind($_POST)) { mosRedirect('index2.php', $row->getError()); } // if Session Authentication Type changed, delete all old Frontend sessions only - which used old Authentication Type if ($mosConfig_session_type != $row->config_session_type) { $past = time(); $query = "DELETE FROM #__session" . "\n WHERE time < " . $database->Quote($past) . "\n AND (" . "\n ( guest = 1 AND userid = 0 ) OR ( guest = 0 AND gid > 0 )" . "\n )"; $database->setQuery($query); $database->query(); } $server_time = date('O') / 100; $offset = $_POST['config_offset_user'] - $server_time; $row->config_offset = $offset; //override any possible database password change $row->config_password = $mosConfig_password; // handling of special characters $row->config_sitename = htmlspecialchars($row->config_sitename, ENT_QUOTES); // handling of quotes (double and single) and amp characters // htmlspecialchars not used to preserve ability to insert other html characters $row->config_offline_message = ampReplace($row->config_offline_message); $row->config_offline_message = str_replace('"', '"', $row->config_offline_message); $row->config_offline_message = str_replace("'", ''', $row->config_offline_message); // handling of quotes (double and single) and amp characters // htmlspecialchars not used to preserve ability to insert other html characters $row->config_error_message = ampReplace($row->config_error_message); $row->config_error_message = str_replace('"', '"', $row->config_error_message); $row->config_error_message = str_replace("'", ''', $row->config_error_message); $config = "<?php \n"; $RGEmulation = intval(mosGetParam($_POST, 'rgemulation', 0)); $config .= "if(!defined('RG_EMULATION')) { define( 'RG_EMULATION', {$RGEmulation} ); }\n"; $config .= $row->getVarText(); $config .= "setlocale (LC_TIME, \$mosConfig_locale);\n"; $config .= '?>'; $fname = $mosConfig_absolute_path . '/configuration.php'; $enable_write = intval(mosGetParam($_POST, 'enable_write', 0)); $oldperms = fileperms($fname); if ($enable_write) { @chmod($fname, $oldperms | 0222); } if ($fp = fopen($fname, 'w')) { fputs($fp, $config, strlen($config)); fclose($fp); if ($enable_write) { @chmod($fname, $oldperms); } else { if (mosGetParam($_POST, 'disable_write', 0)) { @chmod($fname, $oldperms & 0777555); } } // if $msg = 'Configuração atualizada com sucesso'; // apply file and directory permissions if requested by user $applyFilePerms = mosGetParam($_POST, 'applyFilePerms', 0) && $row->config_fileperms != ''; $applyDirPerms = mosGetParam($_POST, 'applyDirPerms', 0) && $row->config_dirperms != ''; if ($applyFilePerms || $applyDirPerms) { $mosrootfiles = array('administrator', 'cache', 'components', 'images', 'language', 'mambots', 'media', 'modules', 'templates', 'configuration.php'); $filemode = NULL; if ($applyFilePerms) { $filemode = octdec($row->config_fileperms); } $dirmode = NULL; if ($applyDirPerms) { $dirmode = octdec($row->config_dirperms); } foreach ($mosrootfiles as $file) { mosChmodRecursive($mosConfig_absolute_path . '/' . $file, $filemode, $dirmode); } } // if switch ($task) { case 'apply': mosRedirect('index2.php?option=com_config&hidemainmenu=1', $msg); break; case 'save': default: mosRedirect('index2.php', $msg); break; } } else { if ($enable_write) { @chmod($fname, $oldperms); } mosRedirect('index2.php', 'Ocorreu um Erro! Não foi possível abrir o arquivo de configuração em modo de escrita!'); } }
public static function edit(&$menu, &$components, &$lists, &$params, $option) { global $mosConfig_live_site; if ($menu->id) { $title = '[ ' . $lists['componentname'] . ' ]'; } else { $title = ''; } ?> <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } var comp_links = new Array; <?php foreach ($components as $row) { ?> comp_links[ <?php echo $row->value; ?> ] = 'index.php?<?php echo addslashes($row->link); ?> '; <?php } ?> if ( form.id.value == 0 ) { var comp_id = getSelectedValue( 'adminForm', 'componentid' ); form.link.value = comp_links[comp_id]; } else { form.link.value = comp_links[form.componentid.value]; } if ( trim( form.name.value ) == "" ){ alert( "Item must have a name" ); } else if (form.componentid.value == ""){ alert( "Please select a Component" ); } else { submitform( pressbutton ); } } </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th> <?php echo $menu->id ? 'Edit' : 'Add'; ?> Menu Item :: Component <small><small><?php echo $title; ?> </small></small> </th> </tr> </table> <table width="100%"> <tr valign="top"> <td width="60%"> <table class="adminform"> <tr> <th colspan="2"> Details </th> </tr> <tr> <td width="10%" align="right">Name:</td> <td width="80%"> <input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php echo htmlspecialchars($menu->name, ENT_QUOTES); ?> " /> </td> </tr> <tr> <td valign="top" align="right">Component:</td> <td> <?php echo $lists['componentid']; ?> </td> </tr> <tr> <td width="10%" align="right">URL:</td> <td width="80%"> <?php echo ampReplace($lists['link']); ?> </td> </tr> <tr> <td align="right">Parent Item:</td> <td> <?php echo $lists['parent']; ?> </td> </tr> <tr> <td valign="top" align="right">Ordering:</td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right">Access Level:</td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right">Published:</td> <td> <?php echo $lists['published']; ?> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </td> <td width="40%"> <table class="adminform"> <tr> <th> Parameters </th> </tr> <tr> <td> <?php if ($menu->id) { echo $params->render(); } else { ?> <strong>Parameter list will be available once you save this New menu item</strong> <?php } ?> </td> </tr> </table> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="id" value="<?php echo $menu->id; ?> " /> <input type="hidden" name="link" value="" /> <input type="hidden" name="menutype" value="<?php echo $menu->menutype; ?> " /> <input type="hidden" name="type" value="<?php echo $menu->type; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <script language="Javascript" src="<?php echo $mosConfig_live_site; ?> /includes/js/overlib_mini.js"></script> <?php }
/** * Outputs the pathway breadcrumbs * @param database A database connector object * @param int The db id field value of the current menu item */ function showPathway($Itemid) { global $database, $option, $task, $mainframe, $mosConfig_absolute_path, $mosConfig_live_site, $my; // the the whole menu array and index the array by the id $query = "SELECT id, name, link, parent, type, menutype, access" . "\n FROM #__menu" . "\n WHERE published = 1" . "\n AND access <= " . (int) $my->gid . "\n ORDER BY menutype, parent, ordering"; $database->setQuery($query); $mitems = $database->loadObjectList('id'); // get the home page $home_menu = new mosMenu($database); foreach ($mitems as $mitem) { if ($mitem->menutype == 'mainmenu') { $home_menu = $mitem; break; } } $optionstring = ''; if (isset($_SERVER['REQUEST_URI'])) { $optionstring = $_SERVER['REQUEST_URI']; } else { if (isset($_SERVER['QUERY_STRING'])) { $optionstring = $_SERVER['QUERY_STRING']; } } // are we at the home page or not $homekeys = array_keys($mitems); $home = @$mitems[$home_menu->id]->name; $path = ''; // this is a patch job for the frontpage items! aje if ($Itemid == $home_menu->id) { switch ($option) { case 'content': $id = intval(mosGetParam($_REQUEST, 'id', 0)); if ($task == 'blogsection') { $query = "SELECT title, id" . "\n FROM #__sections" . "\n WHERE id = " . (int) $id; } else { if ($task == 'blogcategory') { $query = "SELECT title, id" . "\n FROM #__categories" . "\n WHERE id = " . (int) $id; } else { $query = "SELECT title, catid, id" . "\n FROM #__content" . "\n WHERE id = " . (int) $id; } } $database->setQuery($query); $row = null; $database->loadObject($row); $id = max(array_keys($mitems)) + 1; // add the content item $mitem2 = pathwayMakeLink($Itemid, $row->title, '', 1); $mitems[$id] = $mitem2; $Itemid = $id; $home = '<a href="' . sefRelToAbs('index.php') . '" class="pathway">' . $home . '</a>'; break; } } // breadcrumbs for content items switch (@$mitems[$Itemid]->type) { // menu item = List - Content Section case 'content_section': $id = intval(mosGetParam($_REQUEST, 'id', 0)); switch ($task) { case 'category': if ($id) { $query = "SELECT title, id" . "\n FROM #__categories" . "\n WHERE id = " . (int) $id . "\n AND access <= " . (int) $my->id; $database->setQuery($query); $title = $database->loadResult(); $id = max(array_keys($mitems)) + 1; $mitem = pathwayMakeLink($id, $title, 'index.php?option=' . $option . '&task=' . $task . '&id=' . $id . '&Itemid=' . $Itemid, $Itemid); $mitems[$id] = $mitem; $Itemid = $id; } break; case 'view': if ($id) { // load the content item name and category $query = "SELECT title, catid, id, access" . "\n FROM #__content" . "\n WHERE id = " . (int) $id; $database->setQuery($query); $row = null; $database->loadObject($row); // load and add the category $query = "SELECT c.title AS title, s.id AS sectionid, c.id AS id, c.access AS cat_access" . "\n FROM #__categories AS c" . "\n LEFT JOIN #__sections AS s" . "\n ON c.section = s.id" . "\n WHERE c.id = " . (int) $row->catid . "\n AND c.access <= " . (int) $my->id; $database->setQuery($query); $result = $database->loadObjectList(); $title = $result[0]->title; $sectionid = $result[0]->sectionid; $id = max(array_keys($mitems)) + 1; $mitem1 = pathwayMakeLink($Itemid, $title, 'index.php?option=' . $option . '&task=category§ionid=' . $sectionid . '&id=' . $row->catid, $Itemid); $mitems[$id] = $mitem1; if ($row->access <= $my->gid) { // add the final content item $id++; $mitem2 = pathwayMakeLink($Itemid, $row->title, '', $id - 1); $mitems[$id] = $mitem2; } $Itemid = $id; } break; } break; // menu item = Table - Content Category // menu item = Table - Content Category case 'content_category': $id = intval(mosGetParam($_REQUEST, 'id', 0)); switch ($task) { case 'view': if ($id) { // load the content item name and category $query = "SELECT title, catid, id" . "\n FROM #__content" . "\n WHERE id = " . (int) $id . "\n AND access <= " . (int) $my->id; $database->setQuery($query); $row = null; $database->loadObject($row); $id = max(array_keys($mitems)) + 1; // add the final content item $mitem2 = pathwayMakeLink($Itemid, $row->title, '', $Itemid); $mitems[$id] = $mitem2; $Itemid = $id; } break; } break; // menu item = Blog - Content Category // menu item = Blog - Content Section // menu item = Blog - Content Category // menu item = Blog - Content Section case 'content_blog_category': case 'content_blog_section': switch ($task) { case 'view': $id = intval(mosGetParam($_REQUEST, 'id', 0)); if ($id) { // load the content item name and category $query = "SELECT title, catid, id" . "\n FROM #__content" . "\n WHERE id = " . (int) $id . "\n AND access <= " . (int) $my->id; $database->setQuery($query); $row = null; $database->loadObject($row); $id = max(array_keys($mitems)) + 1; $mitem2 = pathwayMakeLink($Itemid, $row->title, '', $Itemid); $mitems[$id] = $mitem2; $Itemid = $id; } break; } break; } $i = count($mitems); $mid = $Itemid; $imgPath = 'templates/' . $mainframe->getTemplate() . '/images/arrow.png'; if (file_exists("{$mosConfig_absolute_path}/{$imgPath}")) { $img = '<img src="' . $mosConfig_live_site . '/' . $imgPath . '" border="0" alt="arrow" />'; } else { $imgPath = '/images/M_images/arrow.png'; if (file_exists($mosConfig_absolute_path . $imgPath)) { $img = '<img src="' . $mosConfig_live_site . '/images/M_images/arrow.png" alt="arrow" />'; } else { $img = '>'; } } while ($i--) { if (!$mid || empty($mitems[$mid]) || $Itemid == $home_menu->id || !preg_match("option", $optionstring)) { break; } $item =& $mitems[$mid]; $itemname = stripslashes($item->name); // if it is the current page, then display a non hyperlink if ($item->id == $Itemid && !$mainframe->getCustomPathWay() || empty($mid) || empty($item->link)) { $newlink = " {$itemname}"; } else { if (isset($item->type) && $item->type == 'url') { $correctLink = preg_match('/http:\\/\\//i', $item->link); if ($correctLink == 1) { $newlink = '<a href="' . $item->link . '" target="_window" class="pathway">' . $itemname . '</a>'; } else { $newlink = $itemname; } } else { $newlink = '<a href="' . sefRelToAbs($item->link . '&Itemid=' . $item->id) . '" class="pathway">' . $itemname . '</a>'; } } // converts & to & for xtml compliance $newlink = ampReplace($newlink); if (trim($newlink) != "") { $path = $img . ' ' . $newlink . ' ' . $path; } else { $path = ''; } $mid = $item->parent; } if (preg_match('/option/i', $optionstring) && trim($path)) { $home = '<a href="' . sefRelToAbs('index.php') . '" class="pathway">' . $home . '</a>'; } if ($mainframe->getCustomPathWay()) { $path .= $img . ' '; $path .= implode("{$img} ", $mainframe->getCustomPathWay()); } if ($Itemid && $Itemid != 99999999) { echo '<span class="pathway">' . $home . ' ' . $path . '</span>'; } }
/** * Writes the edit form for new and existing content item * * A new record is defined when <var>$row</var> is passed with the <var>id</var> * property set to 0. * @param mosContent The category object * @param string The html for the groups select list */ function editContent(&$row, $section, &$lists, &$sectioncategories, &$images, &$params, $option, $redirect, &$menus) { global $database; mosMakeHtmlSafe($row); $nullDate = $database->getNullDate(); $create_date = null; if ($row->created != $nullDate) { $create_date = mosFormatDate($row->created, '%A, %d %B %Y %H:%M', '0'); } $mod_date = null; if ($row->modified != $nullDate) { $mod_date = mosFormatDate($row->modified, '%A, %d %B %Y %H:%M', '0'); } $tabs = new mosTabs(1); // used to hide "Reset Hits" when hits = 0 if (!$row->hits) { $visibility = "style='display: none; visibility: hidden;'"; } else { $visibility = ""; } mosCommonHTML::loadOverlib(); mosCommonHTML::loadCalendar(); ?> <script language="javascript" type="text/javascript"> <!-- var sectioncategories = new Array; <?php $i = 0; foreach ($sectioncategories as $k => $items) { foreach ($items as $v) { echo "sectioncategories[" . $i++ . "] = new Array( '{$k}','" . addslashes($v->id) . "','" . addslashes($v->name) . "' );\t"; } } ?> var folderimages = new Array; <?php $i = 0; foreach ($images as $k => $items) { foreach ($items as $v) { echo "folderimages[" . $i++ . "] = new Array( '{$k}','" . addslashes(ampReplace($v->value)) . "','" . addslashes(ampReplace($v->text)) . "' );\t"; } } ?> function submitbutton(pressbutton) { var form = document.adminForm; if ( pressbutton == 'menulink' ) { if ( form.menuselect.value == "" ) { alert( "Selecione um menu" ); return; } else if ( form.link_name.value == "" ) { alert( "Por favor, informe um nome para este item do menu" ); return; } } if (pressbutton == 'cancel') { submitform( pressbutton ); return; } // assemble the images back into one field var temp = new Array; for (var i=0, n=form.imagelist.options.length; i < n; i++) { temp[i] = form.imagelist.options[i].value; } form.images.value = temp.join( '\n' ); // do field validation if (form.title.value == ""){ alert( "Item de conteúdo deve ter um título" ); } else if (form.sectionid.value == "-1"){ alert( "Você deve selecionar uma seção." ); } else if (form.catid.value == "-1"){ alert( "Você deve selecionar uma categoria." ); } else if (form.catid.value == ""){ alert( "Você deve selecionar uma categoria." ); } else { <?php getEditorContents('editor1', 'introtext'); ?> <?php getEditorContents('editor2', 'fulltext'); ?> submitform( pressbutton ); } } //--> </script> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th class="edit"> Itens de Conteúdo: <small> <?php echo $row->id ? 'Editar' : 'Novo'; ?> </small> <?php if ($row->id) { ?> <small><small> [ Seção: <?php echo $section; ?> ] </small></small> <?php } ?> </th> </tr> </table> <table cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="60%" valign="top"> <table width="100%" class="adminform"> <tr> <td width="100%"> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr> <th colspan="4"> Detalhes do Item </th> </tr> <tr> <td> Título: </td> <td> <input class="text_area" type="text" name="title" size="30" maxlength="100" value="<?php echo $row->title; ?> " /> </td> <td> Seção: </td> <td> <?php echo $lists['sectionid']; ?> </td> </tr> <tr> <td> Sub-Título: </td> <td> <input name="title_alias" type="text" class="text_area" id="title_alias" value="<?php echo $row->title_alias; ?> " size="30" maxlength="100" /> </td> <td> Categoria: </td> <td> <?php echo $lists['catid']; ?> </td> </tr> </table> </td> </tr> <tr> <td width="100%"> Texto de Introdução: (necessário) <br /><?php // parameters : areaname, content, hidden field, width, height, rows, cols editorArea('editor1', $row->introtext, 'introtext', '100%;', '350', '75', '20'); ?> </td> </tr> <tr> <td width="100%"> Texto principal: (opcional) <br /><?php // parameters : areaname, content, hidden field, width, height, rows, cols editorArea('editor2', $row->fulltext, 'fulltext', '100%;', '400', '75', '30'); ?> </td> </tr> </table> </td> <td valign="top" width="40%"> <?php $tabs->startPane("content-pane"); $tabs->startTab("Publicação", "publish-page"); ?> <table class="adminform"> <tr> <th colspan="2"> Info da Publicação </th> </tr> <tr> <td valign="top" align="right" width="120"> Exibir na Página Inicial: </td> <td> <input type="checkbox" name="frontpage" value="1" <?php echo $row->frontpage ? 'checked="checked"' : ''; ?> /> </td> </tr> <tr> <td valign="top" align="right"> Publicado: </td> <td> <input type="checkbox" name="published" value="1" <?php echo $row->state ? 'checked="checked"' : ''; ?> /> </td> </tr> <tr> <td valign="top" align="right"> Nível de Acesso: </td> <td> <?php echo $lists['access']; ?> </td> </tr> <tr> <td valign="top" align="right"> Apelido do Autor: </td> <td> <input type="text" name="created_by_alias" size="30" maxlength="100" value="<?php echo $row->created_by_alias; ?> " class="text_area" /> </td> </tr> <tr> <td valign="top" align="right"> Alterar Autor: </td> <td> <?php echo $lists['created_by']; ?> </td> </tr> <tr> <td valign="top" align="right">Ordem:</td> <td> <?php echo $lists['ordering']; ?> </td> </tr> <tr> <td valign="top" align="right"> Alterar Data de Criação </td> <td> <input class="text_area" type="text" name="created" id="created" size="25" maxlength="19" value="<?php echo $row->created; ?> " /> <input name="reset" type="reset" class="button" onclick="return showCalendar('created', 'y-mm-dd');" value="..." /> </td> </tr> <tr> <td valign="top" align="right"> Início da Publicação: </td> <td> <input class="text_area" type="text" name="publish_up" id="publish_up" size="25" maxlength="19" value="<?php echo $row->publish_up; ?> " /> <input type="reset" class="button" value="..." onclick="return showCalendar('publish_up', 'y-mm-dd');" /> </td> </tr> <tr> <td valign="top" align="right"> Fim da Publicação: </td> <td> <input class="text_area" type="text" name="publish_down" id="publish_down" size="25" maxlength="19" value="<?php echo $row->publish_down; ?> " /> <input type="reset" class="button" value="..." onclick="return showCalendar('publish_down', 'y-mm-dd');" /> </td> </tr> </table> <br /> <table class="adminform"> <?php if ($row->id) { ?> <tr> <td> <strong>ID do conteúdo:</strong> </td> <td> <?php echo $row->id; ?> </td> </tr> <?php } ?> <tr> <td width="120" valign="top" align="right"> <strong>Estado:</strong> </td> <td> <?php echo $row->state > 0 ? 'Publicado' : ($row->state < 0 ? 'Arquivado' : 'Rascunho não publicado'); ?> </td> </tr> <tr > <td valign="top" align="right"> <strong> Acessos </strong>: </td> <td> <?php echo $row->hits; ?> <div <?php echo $visibility; ?> > <input name="reset_hits" type="button" class="button" value="Reiniciar Contagem" onclick="submitbutton('resethits');" /> </div> </td> </tr> <tr> <td valign="top" align="right"> <strong> Revisão </strong>: </td> <td> <?php echo $row->version; ?> vez(es) </td> </tr> <tr> <td valign="top" align="right"> <strong> Criado </strong> </td> <td> <?php if (!$create_date) { ?> Novo documento <?php } else { echo $create_date; } ?> </td> </tr> <tr> <td valign="top" align="right"> <strong> Última Alteração </strong> </td> <td> <?php if (!$mod_date) { ?> Não alterado <?php } else { echo $mod_date; ?> <br /> <?php echo $row->modifier; } ?> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab("Imagens", "images-page"); ?> <table class="adminform" width="100%"> <tr> <th colspan="2"> Controle do MOSImage </th> </tr> <tr> <td colspan="2"> <table width="100%"> <tr> <td width="48%" valign="top"> <div align="center"> Imagens na Galeria: <br /> <?php echo $lists['imagefiles']; ?> </div> </td> <td width="2%"> <input class="button" type="button" value=">>" onclick="addSelectedToList('adminForm','imagefiles','imagelist')" title="Adicionar"/> <br /> <input class="button" type="button" value="<<" onclick="delSelectedFromList('adminForm','imagelist')" title="Remover"/> </td> <td width="48%"> <div align="center"> Imagens no Artigo: <br /> <?php echo $lists['imagelist']; ?> <br /> <input class="button" type="button" value="Para cima" onclick="moveInList('adminForm','imagelist',adminForm.imagelist.selectedIndex,-1)" /> <input class="button" type="button" value="Para baixo" onclick="moveInList('adminForm','imagelist',adminForm.imagelist.selectedIndex,+1)" /> </div> </td> </tr> </table> Sub-pastas: <?php echo $lists['folders']; ?> </td> </tr> <tr valign="top"> <td> <div align="center"> Imagem de amostra:<br/> <img name="view_imagefiles" src="../images/M_images/blank.png" alt="Imagem vazia padrão" width="100" /> </div> </td> <td valign="top"> <div align="center"> Imagem Ativa:<br/> <img name="view_imagelist" src="../images/M_images/blank.png" alt="Imagem Ativa" width="100" /> </div> </td> </tr> <tr> <td colspan="2"> Edite a imagem selecionada: <table> <tr> <td align="right"> Fonte: </td> <td> <input class="text_area" type="text" name= "_source" value="" /> </td> </tr> <tr> <td align="right"> Alinhamento: </td> <td> <?php echo $lists['_align']; ?> </td> </tr> <tr> <td align="right"> Texto Alt: </td> <td> <input class="text_area" type="text" name="_alt" value="" /> </td> </tr> <tr> <td align="right"> Borda: </td> <td> <input class="text_area" type="text" name="_border" value="" size="3" maxlength="1" /> </td> </tr> <tr> <td align="right"> Sub-Título: </td> <td> <input class="text_area" type="text" name="_caption" value="" size="30" /> </td> </tr> <tr> <td align="right"> Posição do Sub-Título: </td> <td> <?php echo $lists['_caption_position']; ?> </td> </tr> <tr> <td align="right"> Alinhamento do Sub-Título: </td> <td> <?php echo $lists['_caption_align']; ?> </td> </tr> <tr> <td align="right"> Largura Sub-Título: </td> <td> <input class="text_area" type="text" name="_width" value="" size="5" maxlength="5" /> </td> </tr> <tr> <td colspan="2"> <input class="button" type="button" value="Aplicar" onclick="applyImageProps()" /> </td> </tr> </table> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab("Parâmetros", "params-page"); ?> <table class="adminform"> <tr> <th colspan="2"> Controle de Parâmetros </th> </tr> <tr> <td> Estes parâmetros somente controlam o que você vê quando clica para visualizar um item completamente <br /><br /> </td> </tr> <tr> <td> <?php echo $params->render(); ?> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab("Meta dados", "metadata-page"); ?> <table class="adminform"> <tr> <th colspan="2"> Meta Dados </th> </tr> <tr> <td> Descrição: <br /> <textarea class="text_area" cols="30" rows="3" style="width: 350px; height: 50px" name="metadesc"><?php echo str_replace('&', '&', $row->metadesc); ?> </textarea> </td> </tr> <tr> <td> Palavras Chaves: <br /> <textarea class="text_area" cols="30" rows="3" style="width: 350px; height: 50px" name="metakey"><?php echo str_replace('&', '&', $row->metakey); ?> </textarea> </td> </tr> <tr> <td> <input type="button" class="button" value="Adicionar titulo Seção/Categoria/Título" onclick="f=document.adminForm;f.metakey.value=document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].text+', '+getSelectedText('adminForm','catid')+', '+f.title.value+f.metakey.value;" /> </td> </tr> </table> <?php $tabs->endTab(); $tabs->startTab("Link para o Menu", "link-page"); ?> <table class="adminform"> <tr> <th colspan="2"> Link para o Menu </th> </tr> <tr> <td colspan="2"> Isto irá criar um 'Link - Item de Conteúdo' no menu que você selecionou <br /><br /> </td> </tr> <tr> <td valign="top" width="90"> Selecione um Menu </td> <td> <?php echo $lists['menuselect']; ?> </td> </tr> <tr> <td valign="top" width="90"> Nome do Menu </td> <td> <input type="text" name="link_name" class="inputbox" value="" size="30" /> </td> </tr> <tr> <td> </td> <td> <input name="menu_link" type="button" class="button" value="Link para o Menu" onclick="submitbutton('menulink');" /> </td> </tr> <tr> <th colspan="2"> Links de Menu Existentes </th> </tr> <?php if ($menus == NULL) { ?> <tr> <td colspan="2"> Nenhum </td> </tr> <?php } else { mosCommonHTML::menuLinksContent($menus); } ?> <tr> <td colspan="2"> </td> </tr> </table> <?php $tabs->endTab(); $tabs->endPane(); ?> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <input type="hidden" name="version" value="<?php echo $row->version; ?> " /> <input type="hidden" name="mask" value="0" /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="redirect" value="<?php echo $redirect; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="images" value="" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <?php }
function genMenuItem(&$row, $level, $pos) { global $Itemid, $mosConfig_live_site, $mainframe; $txt = ''; switch ($row->type) { case 'separator': case 'component_item_link': break; case 'url': if (eregi('index.php\\?', $row->link)) { if (!eregi('Itemid=', $row->link)) { $row->link .= '&Itemid=' . $row->id; } } break; case 'content_item_link': case 'content_typed': // load menu params $menuparams = new mosParameters($row->params, $mainframe->getPath('menu_xml', $row->type), 'menu'); $unique_itemid = $menuparams->get('unique_itemid', 1); if ($unique_itemid) { $row->link .= '&Itemid=' . $row->id; } else { $temp = split('&task=view&id=', $row->link); if ($row->type == 'content_typed') { $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 1, 0); } else { $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 1); } } break; default: $row->link .= '&Itemid=' . $row->id; break; } $row->link = ampReplace($row->link); if (strcasecmp(substr($row->link, 0, 4), 'http')) { $row->link = sefRelToAbs($row->link); } $active = in_array($row->id, $this->parent->open) ? "class = \"active\"" : ""; $id = 'id="menu' . $row->id . '"'; $txt = $row->name; if ($this->getParam('menu_images')) { $menu_params = new stdClass(); $menu_params =& new mosParameters($row->params); $menu_image = $menu_params->def('menu_image', -1); if ($menu_image != '-1' && $menu_image) { $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $row->name . '"/>'; if ($this->getParam('menu_images_align')) { $txt = $txt . ' ' . $image; } else { $txt = $image . ' ' . $txt; } } } $title = " title=\"{$row->name}\""; if ($active) { $active = $row->parent == 0 && $pos == 0 ? "class=\"active-first-item\"" : "class = \"active\""; } else { $active = $row->parent == 0 && $pos == 0 ? "class=\"first-item\"" : ""; } switch ($row->browserNav) { // cases are slightly different case 1: // open in a new window $txt = '<a href="' . $row->link . '" target="_blank" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>'; break; case 2: // open in a popup window $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $row->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" " . $active . " " . $id . $title . "><span>" . $txt . "</span></a>\n"; break; case 3: // don't link it $txt = '<a href="#" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>'; break; default: // formerly case 2 // open in parent window $txt = '<a href="' . $row->link . '" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>'; break; } echo $txt; }