function show_add_event($course_id, $option, &$agenda_item, $lists) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); $content = $title = ''; $start_date = $end_date = date('Y-m-d'); if ($agenda_item) { $content = $agenda_item->content; $title = $agenda_item->title; $start_date = $agenda_item->start_date; $end_date = $agenda_item->end_date; $is_time_related = $agenda_item->is_time_related; $show_period = $agenda_item->show_period; } ?> <script language="javascript" type="text/javascript"> <!-- var start_date = ''; function setgood() { return true; } function submitbutton(task){ elem = document.forms.adminForm; try { elem.onsubmit(); } catch(e) { //alert(e); } if (task == 'save_agenda'){ if (elem.jlms_agenda_title.value.length < 1){ alert ('<?php echo _JLMS_AGENDA_TITLE_INCORRECT; ?> '); elem.jlms_agenda_title.focus(); } else { elem.submit(); } } else{ elem.mode.value = task; elem.submit(); } } //--> </script> <form action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " method="post" name="adminForm" onsubmit="setgood();"> <table width="100%" cellpadding="2" cellspacing="0" border="0" id="jlms_item_properties"> <tr> <td colspan="2"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders"> <tr> <td width="100%" valign="middle" style="vertical-align:middle " rowspan="2" class="contentheading"> <?php echo _JLMS_AGENDA_ADD_ITEM; ?> </td> <td align="right" valign="top" style="vertical-align:top "> <?php $toolbar = array(); $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_agenda');"); $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_agenda');"); echo JLMS_ShowToolbar($toolbar); ?> </td> </tr> </table> </td> </tr> <tr> <td valign="middle"><br /><?php echo _JLMS_START_DATE; ?> </td> <td valign="middle" style="vertical-align:middle "><br /> <table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr> <td valign="middle" style="vertical-align:middle "> <?php echo JLMS_HTML::_('calendar.calendar', $start_date, 'start', 'start'); ?> </td></tr></table> </td> </tr> <tr> <td><br /><?php echo _JLMS_END_DATE; ?> </td> <td valign="middle" style="vertical-align:middle "><br /> <table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr> <td valign="middle" style="vertical-align:middle "> <?php echo JLMS_HTML::_('calendar.calendar', $end_date, 'end', 'end'); ?> </td></tr></table> </td> </tr> <tr> <td valign="top" style="vertical-align:top "><br /><?php echo _JLMS_IS_TIME_RELATED; ?> </td> <td><br /> <?php if (isset($is_time_related)) { JLMS_HTML::_('showperiod.field', $is_time_related, $show_period); } else { JLMS_HTML::_('showperiod.field'); } ?> </td> </tr> <tr> <td colspan="2" height="20"></td> </tr> <tr> <td> <?php echo _JLMS_LIMIT_RESOURCE_TO_GROUPS; ?> </td> <td> <?php echo $lists['is_limited']; ?> </td> </tr> <tr> <td colspan="2" height="20"></td> </tr> <tr> <td valign="top"> <?php echo _JLMS_LIMIT_RESOURCE_USERGROUPS; ?> </td> <td> <?php echo $lists['groups']; ?> </td> </tr> <tr> <td valign="top" align="left" width="20%" colspan="2"> <?php echo _JLMS_AGENDA_TITLE; ?> </td> </tr> <tr> <td colspan="2"> <input type="text" name="jlms_agenda_title" size="60" value="<?php echo $title; ?> " class="inputbox" /> </td> </tr> <tr> <td colspan="2"> <?php echo _JLMS_DESCRIPTION; ?> </td> </tr> <tr> <td colspan="2"> <?php echo jlms_editorArea('editor1', $content, 'jlms_agenda_detail', '100%;', '250', '40', '20'); ?> </td> </tr> </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="agenda" /> <input type="hidden" name="mode" value="event_save" /> <?php if (isset($agenda_item->agenda_id)) { echo "<input type='hidden' name='edit' value='yes' />"; echo "<input type='hidden' name='agenda_id' value='" . $agenda_item->agenda_id . "' />"; } ?> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> </form> <?php }
function mailbox_users(&$stats, $option, $course_id, &$lists, $filt_group) { global $Itemid, $JLMS_DB, $JLMS_CONFIG; ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- var r_count = parseInt('<?php echo (isset($_POST['usr_id']) ? count($_POST['usr_id']) : 0) + (isset($_POST['grp_id']) ? count($_POST['grp_id']) : 0) + (isset($_POST['mail_id']) ? count($_POST['mail_id']) : 0) + (isset($lists['repl']) ? 1 : 0); ?> '); function reanalize_class(){ var tbl_id = getObj('show_mailz'); if(tbl_id.rows[1]){ for(var i=1;i<tbl_id.rows.length;i++){ if((i % 2 + 1)==1){ tbl_id.rows[i].className = 'sectiontableentry1 odd'; } else { tbl_id.rows[i].className = 'sectiontableentry2 even'; } } } } function Delete_tbl_row(element) { var del_index = element.parentNode.parentNode.sectionRowIndex; var tbl_id = element.parentNode.parentNode.parentNode.parentNode.id; element.parentNode.parentNode.parentNode.deleteRow(del_index); r_count = r_count - 1; reanalize_class(); } function ading_row(texts,valuez,group) { var form = document.adminForm; var tbl_id = getObj('show_mailz'); var row = tbl_id.insertRow(1); row.className = "sectiontableentry1 odd"; var cell1 = document.createElement("td"); var cell2 = document.createElement("td"); var cell3 = document.createElement("td"); var cell4 = document.createElement("td"); input_button = document.createElement("IMG"); input_button.src = "<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png'; ?> "; input_button.onclick = new Function('Delete_tbl_row(this)'); input_button.style.cursor = "pointer"; input_img = document.createElement("IMG"); if(!group) input_img.src = "<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_edituser_22.png'; ?> "; else input_img.src = "<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_editusergroup_22.png'; ?> "; cell1.appendChild(input_button); //cell2.style.width = "10px;"; cell2.appendChild(input_img); cell3.innerHTML = texts; var input_text = document.createElement("input"); input_text.type = "hidden"; if(group==1) { input_text.name = "grp_id[]"; input_text.setAttribute("name","grp_id[]"); } else if(group==2) { input_text.name = "mail_id[]"; input_text.setAttribute("name","mail_id[]"); } else { input_text.name = "usr_id[]"; input_text.setAttribute("name","usr_id[]"); } input_text.value = valuez; cell3.appendChild(input_text); row.appendChild(cell1); row.appendChild(cell2); row.appendChild(cell3); r_count = r_count + 1; reanalize_class(); } function setgood() { return true; } function submitbutton(pressbutton) { var form = document.adminForm; try { form.onsubmit(); } catch(e) { //alert(e); } if (pressbutton == 'mail_send'){ if (form.jlms_subject.value == ''){ alert('<?php echo _JLMS_MB_ENTER_SUBJECT; ?> '); } else{ if (r_count){ form.task.value = pressbutton; form.submit(); } else{ alert('<?php echo _JLMS_MB_ENTER_USERNAME; ?> '); } } } else { form.task.value = pressbutton; form.submit(); } } function mail_to_text() { var ulist = document.adminForm['mailbox_users[]']; for(i=0;i<ulist.length;i++) { if(ulist[i].value == 0 && ulist[i].selected) { ading_row(ulist[i].text,'<?php echo $filt_group; ?> ',1); break; } else if(ulist[i].selected) { if(ulist[i].value>0) ading_row(ulist[i].text,ulist[i].value,0); else ading_row(ulist[i].text,ulist[i].value,2); } } } //--><!]]> </script> <?php JLMS_TMPL::OpenMT(); if (!$course_id) { $hparams = array('show_menu' => false); } else { $hparams = array(); } $toolbar = array(); $toolbar[] = array('btn_type' => 'mail_inbox', 'btn_js' => "javascript:submitbutton('mailbox');"); $toolbar[] = array('btn_type' => 'mail_outbox', 'btn_js' => "javascript:submitbutton('mail_sendbox');"); $toolbar[] = array('btn_type' => 'send', 'btn_js' => "javascript:submitbutton('mail_send');"); JLMS_TMPL::ShowHeader('mailbox', _JLMS_MB_TITLE, $hparams, $toolbar); JLMS_TMPL::OpenTS(); ?> <form action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " enctype="multipart/form-data" method="post" name="adminForm" onsubmit="setgood();"> <table width="100%" cellpadding="2" cellspacing="0" border="0" class="jlms_table_no_borders" style="float:left;"> <tr> <td align="left" style="text-align:left; width:360px; " valign="top"> <div align="left" style="white-space:nowrap "> <?php echo $lists['mailbox_users']; ?> </div> <div align="left" style="white-space:nowrap "><?php echo $lists['filter2']; ?> </div> </td> <td width="50" valign="top"> <?php $btn_img = '2rightarrow.png'; // 29.04.2008 - 'alt' and 'src' - changed by DEN echo "<img src=\"" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . "/" . $btn_img . "\" alt='>' onclick='mail_to_text();' style='cursor:pointer; padding-top:45px;' />"; ?> </td> <td valign="top" width="45%"> <table id="show_mailz" cellpadding="0" cellspacing="0" border="0" width="100%" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="25"><!-- gg --> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="25"><!-- gg --> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_MB_RECEPIENTS; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $z = 0; if (isset($lists['repl'])) { $_POST['usr_id'][0] = $lists['repl']->sender_id; } if (isset($_POST['usr_id']) && count($_POST['usr_id'])) { for ($i = 0; $i < count($_POST['usr_id']); $i++) { if ($_POST['usr_id'][$i]) { echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($z % 2 + 1)) . '">'; echo '<td width="25" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png" alt="' . _JLMS_DELETE . '" onclick="Delete_tbl_row(this);" style="cursor:pointer;" /></td>'; echo '<td width="10" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '//buttons_22/btn_edituser_22.png" /></td>'; if ($JLMS_CONFIG->get('use_global_groups', 0)) { $query = "SELECT a.id, a.name, a.username, a.email, b.ug_name" . "\n FROM #__users as a, #__lms_users_in_global_groups as c" . "\n LEFT JOIN #__lms_usergroups as b ON c.group_id = b.id AND b.course_id = '0'" . "\n WHERE a.id = c.user_id AND a.id=" . intval($_POST['usr_id'][$i]) . "" . "\n ORDER BY b.ug_name, a.username"; $JLMS_DB->SetQuery($query); $users = $JLMS_DB->LoadObjectList(); } else { $query = "SELECT a.id, a.name, a.username, a.email, b.ug_name" . "\n FROM #__users as a, #__lms_users_in_groups as c" . "\n LEFT JOIN #__lms_usergroups as b ON c.group_id = b.id AND b.course_id = '" . $course_id . "'" . "\n WHERE a.id = c.user_id AND c.course_id = '" . $course_id . "' AND a.id=" . intval($_POST['usr_id'][$i]) . "" . "\n ORDER BY b.ug_name, a.username"; $JLMS_DB->SetQuery($query); $users = $JLMS_DB->LoadObjectList(); } if (!count($users)) { $query = "SELECT username,name FROM #__users WHERE id=" . intval($_POST['usr_id'][$i]); $JLMS_DB->SetQuery($query); $users = $JLMS_DB->LoadObjectList(); if (count($users)) { $users[0]->username = _JLMS_ROLE_TEACHER . ' - ' . $users[0]->username . ' (' . $users[0]->name . ')'; } } else { $users[0]->username = ($users[0]->ug_name ? $users[0]->ug_name : '') . ' - ' . $users[0]->username . ' (' . $users[0]->name . ')'; } echo '<td>' . $users[0]->username . '<input type="hidden" name="usr_id[]" value="' . intval($_POST['usr_id'][$i]) . '" /></td>'; echo '</tr>'; $z++; } } } if (isset($_POST['grp_id']) && count($_POST['grp_id'])) { for ($i = 0; $i < count($_POST['grp_id']); $i++) { echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($z % 2 + 1)) . '">'; echo '<td width="25" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png" alt="' . _JLMS_DELETE . '" onclick="Delete_tbl_row(this);" style="cursor:pointer;" /></td>'; echo '<td width="10" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_editusergroup_22.png" /></td>'; $query = "SELECT distinct a.ug_name as text FROM #__lms_usergroups as a" . "\n WHERE a.id = '" . intval($_POST['grp_id'][$i]) . "' ORDER BY a.ug_name"; $JLMS_DB->SetQuery($query); echo '<td>' . ($JLMS_DB->loadResult() ? $JLMS_DB->loadResult() : _JLMS_MB_ALL_USRS) . '<input type="hidden" name="grp_id[]" value="' . intval($_POST['grp_id'][$i]) . '" /></td>'; echo '</tr>'; $z++; } } if (isset($_POST['mail_id']) && count($_POST['mail_id'])) { for ($i = 0; $i < count($_POST['mail_id']); $i++) { echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($z % 2 + 1)) . '">'; echo '<td width="25"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png" alt="' . _JLMS_DELETE . '" onclick="Delete_tbl_row(this);" style="cursor:pointer;" /></td>'; echo '<td width="10"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_editusergroup_22.png" /></td>'; $query = "SELECT pm_name FROM #__lms_messagelist WHERE id=" . intval(abs($_POST['mail_id'][$i])); $JLMS_DB->SetQuery($query); echo '<td>' . ($JLMS_DB->loadResult() ? $JLMS_DB->loadResult() : _JLMS_MB_ALL_USRS) . '<input type="hidden" name="mail_id[]" value="' . intval($_POST['mail_id'][$i]) . '" /></td>'; echo '</tr>'; $z++; } } ?> </table> <br /> </td> </tr> </table> <div style="clear:both;"></div> <br /> <table width="100%" cellpadding="2" cellspacing="0" border="0" class="jlms_table_no_borders"> <tr> <td valign="top" align="left" > <?php echo _JLMS_MB_SUBJECT; ?> : </td> </tr> <tr> <td> <input type="text" name="jlms_subject" size="60" value="<?php if (isset($lists['repl'])) { echo _JLMS_MB_REPL_RE . $lists['repl']->subject; } ?> " class="inputbox" /> </td> </tr> <tr> <td align="left"> <?php echo _JLMS_MB_TEXT . " :"; ?> </td> </tr> <tr> <td> <?php $curmsg = ''; if (isset($lists['repl'])) { $date_mas = $lists['repl']->data; $main_data = explode('-', substr($date_mas, 0, 10)); $other_data = explode(':', substr($date_mas, 11, 8)); $view_format = date(_JLMS_MB_REPL_DF, mktime($other_data[0], $other_data[1], $other_data[2], $main_data[1], $main_data[2], $main_data[0])); $curmsg_pre = $view_format . ' ' . _JLMS_MB_REPL_YW . ':<br />'; $linebreak = '<br /><br />'; $str = ''; for ($i = 0; $i < 50; $i++) { $str = $str . '-'; } $linebreak .= $str; $linebreak .= '<br />'; $old_msg_external = $lists['repl']->message; $curmsg = $linebreak . $curmsg_pre . $old_msg_external; } jlms_editorArea('editor1', $curmsg, 'jlms_mailbox_letter', '100%;', '250', '40', '20'); ?> </td> </tr> <tr id="hide"> <td> <a href="javascript:void(0)" onclick="javascript:getObj('attach').style.display = '';getObj('hide').style.display = 'none'"><?php echo _JLMS_MB_ATTACH; ?> </a> </td> </tr> <tr style="display:none " id="attach"> <td> <table class="jlms_table_no_borders" width="100%"> <tr> <td> <a href="javascript:void(0)" onclick="javascript:getObj('attach').style.display = 'none';getObj('hide').style.display = ''"><?php echo _JLMS_MB_HIDE; ?> </a> </td> </tr> <tr> <td><input type="file" name="jlms_attach_file" size="60" class="inputbox" /></td> </tr> </table> </td> </tr> </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="mailbox_new" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="m_course_id" value="<?php echo isset($lists['repl']->course_id) && $lists['repl']->course_id ? $lists['repl']->course_id : -1; ?> " /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="state" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); JLMS_TMPL::CloseMT(); // 29.04.2008 - line added by DEN (layout fix) }