function _DEFAULT()
 {
     global $is_jlms_trial_roles_heading_text;
     if (class_exists('JToolBarHelper')) {
         JToolBarHelper::title(_JLMS_ROLES_MANAGEMENT . ($is_jlms_trial_roles_heading_text ? $is_jlms_trial_roles_heading_text : ''), 'user.png');
     }
     JToolBarHelper::custom('default_role', 'publish.png', 'publish_f2.png', _JLMS_DEFAULT, true);
     JToolBarHelper::spacer();
     JToolBarHelper::divider();
     if (JLMS_J16version()) {
         $cfgClass = 'options';
     } else {
         $cfgClass = 'config';
     }
     $bar =& JToolBar::getInstance('toolbar');
     $bar->appendButton('Popup', $cfgClass, 'Roles assignments', 'index.php?tmpl=component&option=com_joomla_lms&task=lms_roles&page=assignment', 950, 500);
     //		$bar->appendButton( 'Popup', 'config', 'Allow role assignments', 'index.php?option=com_joomla_lms&task=lms_roles&page=new' );
     JToolBarHelper::divider();
     JToolBarHelper::spacer();
     JToolBarHelper::addNewX('new');
     JToolBarHelper::spacer();
     JToolBarHelper::editList('edit');
     JToolBarHelper::spacer();
     JToolBarHelper::deleteList('', 'delete', _JLMS_DELETE);
     JToolBarHelper::spacer();
 }
示例#2
0
function JLMS_checkCourseGID($user_id, $course_gid)
{
    global $JLMS_DB, $JLMS_CONFIG;
    $acl =& JLMSFactory::getJoomlaACL();
    //Cache functions (save data about user gid, course gid and access results in JLMS_CONFIG)
    $cache_user_gids = $JLMS_CONFIG->get('cache_user_gids', array());
    $user_item = 'user_' . $user_id;
    if (isset($cache_user_gids[$user_item]) && $cache_user_gids[$user_item]) {
        $userGids = $cache_user_gids[$user_item];
    } else {
        if ($user_id) {
            if (JLMS_J16version()) {
                $userGids = $acl->getGroupsByUser($user_id);
            } else {
                $query = "SELECT gid FROM #__users WHERE id = " . $user_id;
                $JLMS_DB->SetQuery($query);
                $userGids[] = $JLMS_DB->LoadResult();
            }
        } else {
            $userGids = array();
        }
        $cache_user_gids[$user_item] = $userGids;
        $JLMS_CONFIG->set('cache_user_gids', $cache_user_gids);
    }
    $result = false;
    $ac_groups = array(0);
    if ($course_gid) {
        $ac_groups = explode(",", $course_gid);
    }
    if (in_array(0, $ac_groups)) {
        $result = true;
    } elseif ($user_id && is_array($ac_groups)) {
        $adminGroups = JLMS_getAdminGroups();
        $ac_groups = array_unique(array_merge($ac_groups, $adminGroups));
        foreach ($ac_groups as $ag) {
            $cache_gid_checked = $JLMS_CONFIG->get('cache_gid_checked', array());
            foreach ($userGids as $userGid) {
                $cg_item = 'check_gid_' . $userGid . '_' . $ag;
                if (isset($cache_gid_checked[$cg_item])) {
                    if ($cache_gid_checked[$cg_item]) {
                        $result = true;
                        break;
                    }
                } else {
                    if ($userGid == $ag) {
                        $result = true;
                        break;
                    }
                    if ($acl->is_group_child_of(intval($userGid), intval($ag), 'ARO')) {
                        $result = true;
                        break;
                    }
                }
                $cache_gid_checked[$cg_item] = $result;
                $JLMS_CONFIG->set('cache_gid_checked', $cache_gid_checked);
            }
        }
    }
    return $result;
}
示例#3
0
 function h2($text = '')
 {
     if (JLMS_J16version()) {
         return '<h2>' . $text . '</h2>';
     } else {
         return '<div class="contentheading">' . $text . '</div>';
     }
 }
示例#4
0
 function &getJoomlaACL()
 {
     static $instance;
     if (!is_object($instance)) {
         if (JLMS_J16version()) {
             require_once JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . "includes" . DS . 'classes' . DS . 'lms.access.16.php';
             $instance = new JLMSAccess();
         } else {
             $instance =& JFactory::getACL();
         }
     }
     return $instance;
 }
示例#5
0
    function editItem(&$row, &$lists, &$roles, $option)
    {
        ?>
	<script language="javascript" type="text/javascript">
	<!--
	function submitbutton(pressbutton) {
		var form = document.adminForm;

		if (pressbutton == 'cancel') {
			form.page.value = pressbutton;
			form.submit();
			return;
		}
		if (pressbutton == 'save' || pressbutton == 'apply' ) {
			form.page.value = pressbutton;
			form.submit();
			return;
		}
	}
	
	<?php 
        if (JLMS_J16version()) {
            ?>
	Joomla.submitbutton = submitbutton;
	<?php 
        }
        ?>
	//-->
	</script>	
	<form action="index.php" method="post" name="adminForm">	
	<table width="100%" >
		<tr>
			<td valign="top" width="220px">
			<div>
				<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
			</div>
			</td>
			<td valign="top">
			<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
			<table class="adminheading">
			<tr>
				<th class="user">
				<?php 
            echo _JOOMLMS_COMP_NAME;
            ?>
:
				<small>
				<?php 
            echo $row->id ? _JLMS_FRM_EDIT_BOARD : _JLMS_FRM_NEW_BOARD;
            ?>
				</small>
				</th>
			</tr>
			</table>
			<?php 
        }
        ?>
			<div class="width-100">
			<fieldset class="adminform">
			<table width="100%" border="0">
				<tr>
					<td valign="top">
						<table width="100%" >
							<tr>
								<th colspan="2"><?php 
        echo _JLMS_FRM_BOARD_DETS;
        ?>
</th>
							<tr>
							<tr>
								<td align="left" width="20%"><?php 
        echo _JLMS_FRM_BOARD_NAME;
        ?>
:</td>
								<td><input class="text_area" type="text" name="forum_name" style="width:266px;" maxlength="100" value="<?php 
        echo str_replace('"', '&quot;', $row->forum_name);
        ?>
" /></td>
							</tr>
							<tr>
								<td align="left"><?php 
        echo _JLMS_PUBLISHED;
        ?>
:</td>
								<td><fieldset class="radio"><?php 
        echo $lists['published'];
        ?>
</fieldset></td>
							</tr>
							<tr>
								<td align="left"><?php 
        echo _JLMS_FRM_PARENT_BOARD;
        ?>
:</td>
								<td><?php 
        echo $lists['parent_forums'];
        ?>
</td>
							</tr>
							<tr>
								<td align="left"><?php 
        echo _JLMS_FRM_TYPE;
        ?>
:</td>
								<td><?php 
        echo $lists['forum_type'];
        ?>
</td>
							</tr>
							<tr>
								<td align="left"><?php 
        echo _JLMS_FRM_SET_OWN_AS_MOD;
        ?>
:</td>
								<td><fieldset class="radio"><?php 
        echo $lists['moderated'];
        ?>
</fieldset></td>
							</tr>
							<tr>
								<td align="left"><?php 
        echo _JLMS_FRM_ADD_BOARD_MOD;
        ?>
:</td>
								<td><input class="text_area" type="text" name="forum_moderators" style="width:50px;" maxlength="100" value="<?php 
        echo str_replace('"', '&quot;', $row->forum_moderators);
        ?>
" /></td>
							</tr>
							<tr>
								<td align="left" valign="top"><?php 
        echo _JLMS_FRM_BOARD_DESC;
        ?>
:</td>
								<td>
								<textarea class="text_area" name="forum_desc" style="width:266px" cols="35" rows="3"><?php 
        echo $row->forum_desc;
        ?>
</textarea>
								</td>
							</tr>
							<tr>
								<td align="left" colspan="2"><?php 
        echo _JLMS_FRM_YOU_CAN_USE;
        ?>
</td>
							</tr>
							<tr>
								<th colspan="2"><?php 
        echo _JLMS_FRM_ADV_ACC_PERMS;
        ?>
</th>
							<tr>
							<tr>
								<td align="left" valign="top" style="vertical-align:top "><?php 
        echo _JLMS_FRM_ADV_ACC;
        ?>
:</td>
								<td><fieldset class="radio"><?php 
        echo $lists['custom_access'];
        ?>
</fieldset></td>
							</tr>
							<tr>
								<td align="left" valign="top"><?php 
        echo _JLMS_FRM_ADD_PERM;
        ?>
:</td>
								<td>
								<?php 
        echo '<select id="roles_selections" class="text_area" multiple="multiple" style="width:266px" size="10" name="forum_permissions[]">';
        $prev_roletype = 0;
        $cur_permissions = explode(',', $row->forum_permissions);
        foreach ($roles as $role) {
            if ($role->roletype_id != $prev_roletype) {
                if ($prev_roletype) {
                    echo '</optgroup>';
                }
                $prev_roletype = $role->roletype_id;
                if ($role->roletype_id == 4) {
                    echo '<optgroup label="Administrator roles">';
                }
                if ($role->roletype_id == 2) {
                    echo '<optgroup label="Teacher roles">';
                }
                if ($role->roletype_id == 5) {
                    echo '<optgroup label="Assistant roles">';
                }
            }
            $selected = '';
            if (in_array($role->value, $cur_permissions)) {
                $selected = ' selected="selected"';
            }
            echo '<option value="' . $role->value . '"' . $selected . '>' . $role->text . '</option>';
        }
        echo '</optgroup>';
        echo '</select>';
        ?>
								</td>
							</tr>
						</table>
						<br />
					</td>
				</tr>
			</table>
			</fieldset>
			</div>
	</td></tr></table>		
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="task" value="lms_forums" />
		<input type="hidden" name="page" value="" />
		</form>		
		<?php 
    }
    function editConfigSource($content, $option)
    {
        $config_path = JPATH_SITE . '/components/com_joomla_lms/includes/config.inc.php';
        ?>

		<script type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			form.page.value = pressbutton;
			form.submit();
		}
		
		<?php 
        if (JLMS_J16version()) {
            ?>
		Joomla.submitbutton = submitbutton;
		<?php 
        }
        ?>
	
		//-->
		</script>

		<form action="index.php" method="post" name="adminForm">		
		<table cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
			<td valign="top" width="220px">
			<div>
				<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
			</div>
			</td>
			<td valign="top">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
			<tr>
			<td width="290">
		<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
			<table class="adminheading"><tr><th class="config"><?php 
            echo _JOOMLMS_COMP_NAME . ': <small>DEV.config</small>';
            ?>
</th></tr></table>
		<?php 
        }
        ?>
			</td>
			<td width="220">
				<span class="componentheading">config.inc.php is :
				<b><?php 
        echo is_writable($config_path) ? '<font color="green"> ' . _JLMS_WRITABLE . '</font>' : '<font color="red"> ' . _JLMS_UNWRITABLE . '</font>';
        ?>
</b>
				</span>
			</td>
<?php 
        if (mosIsChmodable($config_path)) {
            if (is_writable($config_path)) {
                ?>
			<td>
				<input type="checkbox" id="disable_write" name="disable_write" value="1"/>
				<label for="disable_write"><?php 
                echo _JLMS_CFG_MSG_UNWR_AFTER_SAVE;
                ?>
</label>
			</td>
<?php 
            } else {
                ?>
			<td>
				<input type="checkbox" id="enable_write" name="enable_write" value="1"/>
				<label for="enable_write"><?php 
                echo _JLMS_CFG_MSG_OVERRIDE_PROTT;
                ?>
</label>
			</td>
<?php 
            }
            // if
        }
        // if
        ?>
		</tr>
		</table>
		<div class="width-100">
		<fieldset class="adminform">
		<table >
			<tr><th><?php 
        echo $config_path;
        ?>
</th></tr>
			<tr><td><textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox"><?php 
        echo $content;
        ?>
</textarea></td></tr>
		</table>
		</fieldset>
		</div>
		</td>
		</tr>
		</table>		
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="task" value="dev_config" />
		<input type="hidden" name="page" value="save_config" />
		<input type="hidden" name="<?php 
        echo josSpoofValue();
        ?>
" value="1" />
		</form>		
		<?php 
    }
    function JLMS_results_check_database($option, $out = array(), $end = '', $flag_stop = '', $flag_check_tables = '')
    {
        ?>
	<script type="text/javascript">
	<!--
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		form.page.value = pressbutton;
		form.submit();
	}
	
	<?php 
        if (JLMS_J16version()) {
            ?>
	Joomla.submitbutton = submitbutton;
	<?php 
        }
        ?>
	//-->
	</script>
<form action="index.php" method="post" name="adminForm">
<table width="100%" border="0">
	<tr>
		<td valign="top" width="220px">
		<div>
			<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
		</div>
		</td>
		<td valign="top">
		<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
		<table class="adminheading">
		<tr>
		<tr>
			<th class="config">
			<?php 
            echo _JOOMLMS_COMP_NAME;
            ?>
: <small><?php 
            echo _JLMS_MAIN_CHECK_DB;
            ?>
</small>
			</th>
		</tr>
		</table>
		<?php 
        }
        ?>
		<div class="width-100">
		<fieldset class="adminform">
		<table width="100%" cellpadding="8" cellspacing="0" class="adminlist">
		<thead>
			<tr>
				<th class="title" width="49%" align="left"><?php 
        echo _JLMS_MAIN_TABLE;
        ?>
</th>
				<th class="title" width="49%" align="left"><?php 
        echo _JLMS_MAIN_STATUS;
        ?>
</th>
			</tr>
		</thead>

		<?php 
        if (!$flag_stop) {
            ?>
		<tfoot>
			<tr>
				<td align="center" colspan="2">
					<?php 
            echo str_replace('{link}', 'index.php?option=com_joomla_lms&amp;task=lms_maintenance&amp;page=check_database&amp;table_num=' . $end, _JLMS_MAIN_IF_YOU_SEE);
            ?>
				</td>
			</tr>
		</tfoot>

		<?php 
        } elseif ($flag_stop != 2) {
            ?>
		<tfoot>
			<tr>
				<td align="center" colspan="2">
					<?php 
            echo str_replace('{link}', 'index.php?option=com_joomla_lms&amp;task=lms_maintenance&amp;page=check_tables', _JLMS_MAIN_IF_YOU_SEE);
            ?>
				</td>
			</tr>
		</tfoot>							
		<tbody>
		<?php 
        }
        ?>

			<?php 
        $kk = 0;
        for ($i = 0; $i < count($out); $i++) {
            foreach ($out[$i] as $k => $v) {
                $flag = 0;
                for ($j = 0; $j < count($v); $j++) {
                    ?>
<tr class="<?php 
                    echo "row{$kk}";
                    ?>
">
							<td align="left"><?php 
                    echo $k;
                    ?>
</td>
							<td align="left"><?php 
                    if ($v[$j + 1]) {
                        echo "<font color=\"red\">" . $v[$j + 1] . "</font>";
                    } elseif ($v[$j]) {
                        echo "<font color=\"green\">" . $v[$j] . "</font>";
                    } else {
                        echo "OK";
                    }
                    $j++;
                    ?>
</td>
							</tr><?php 
                    $flag = 1;
                    $kk = 1 - $kk;
                }
                if ($flag == 0) {
                    ?>
<tr class="<?php 
                    echo "row{$kk}";
                    ?>
">
							<td align="left"><?php 
                    echo $k;
                    ?>
</td>
							<td align="left">OK</td>
							</tr><?php 
                    $kk = 1 - $kk;
                }
            }
        }
        ?>
		</tbody>
		</table>
		</fieldset>
		</div>
</td></tr></table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="task" value="lms_maintenance" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="hidemainmenu" value="0" />
		<input type="hidden" name="page" value="" />		
		</form>

		<script type="text/javascript">
		
		<?php 
        if (!$flag_stop || $flag_check_tables) {
            if (!$flag_check_tables) {
                ?>
					var page = 'check_database';
				<?php 
            } else {
                ?>
					var page = 'check_tables';
				<?php 
            }
            ?>
	 	setTimeout('redirect()',5000);
		function redirect() {
			window.location="index.php?option=com_joomla_lms&task=lms_maintenance&page="+page+"&table_num=<?php 
            echo $end;
            ?>
";	
		}
		<?php 
        }
        ?>
		
		//var winScroller = new Fx.Scroll(window);
		//winScroller.toBottom();

		</script>

		<?php 
    }
    function JLMS_editDiscountCoupon(&$row, &$lists, $option)
    {
        ?>

		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'discount_coupons') {
				submitform( pressbutton );
				return;
			}
						
			if( trim(form.name.value)  == '' ) {			
				alert('<?php 
        echo _JLMS_DISC_MSG_ENTR_C_NAME;
        ?>
');
			} else if( trim(form.code.value)  == '' ) {			
				alert('<?php 
        echo _JLMS_DISC_MSG_ENTR_C_CODE;
        ?>
');
			} else if( trim(form.users.value) != '' && !/^[0-9,\,]*$/.test( form.users.value ) ) 
			{
				alert('<?php 
        echo _JLMS_DISC_MSG_USRS_INCOR_VAL;
        ?>
');
			} else if( !/^[0-9,A-Z]*$/.test( form.code.value ) ) 
			{
				alert('<?php 
        echo _JLMS_DISC_MSG_C_CODE_INCOR_VAL;
        ?>
');
			} else {
				submitform( pressbutton );
			}
			
			return true;			
		}
		
		<?php 
        if (JLMS_J16version()) {
            ?>
		Joomla.submitbutton = submitbutton;
		<?php 
        }
        ?>
		
		function trim( value ) {
			return value.replace(/(^\s+)|(\s+$)/g, "");
		}
		//-->
		</script>
		
		<form action="index.php" method="post" name="adminForm">		
		<table width="100%" >
			<tr>
				<td valign="top" width="220">
				<div>
					<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
				</div>
				</td>
				<td valign="top">
				<div class="width-100">
				<fieldset class="adminform">
				<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
					<table class="adminheading" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<th class="categories">
						<?php 
            echo _JOOMLMS_COMP_NAME;
            ?>
: <small><?php 
            echo $row->id ? _JLMS_DISC_C_EDIT : _JLMS_DISC_C_NEW;
            ?>
</small>
						</th>
					</tr>
					</table>
				<?php 
        }
        ?>
			
				<table width="100%" >
					<tr><th colspan="3"><?php 
        echo _JLMS_DISC_C_DETS;
        ?>
</th></tr>
					<tr><td width="20%" align="right"><?php 
        echo _JLMS_NAME;
        ?>
:</td>
						<td><input class="inputbox" type="text" name="name" size="50" maxlength="100" value="<?php 
        echo $row->name;
        ?>
" /></td>
						<td></td>
					</tr>
					<tr><td colspan="3">&nbsp;</td></tr>
					<tr><td width="20%" align="right"><?php 
        echo _JLMS_CODE;
        ?>
:</td>
						<td><input class="inputbox" type="text" name="code" size="50" maxlength="32" value="<?php 
        echo $row->code;
        ?>
" onblur="this.value = this.value.toUpperCase(); return true;" /></td>
						<td></td>
					</tr>				
					<tr>
							<td width="200"><?php 
        echo _JLMS_ENABLED;
        ?>
:</td>
							<td>
								<fieldset class="radio">						
								<input id="diccoupon_yes" type="radio" name="enabled" value="1" <?php 
        if ($row->enabled) {
            echo 'checked';
        }
        ?>
 />
								<label for="diccoupon_yes"><?php 
        echo _JLMS_YES;
        ?>
</label>								
								<input id="diccoupon_no" type="radio" name="enabled" value="0" <?php 
        if (!$row->enabled) {
            echo 'checked';
        }
        ?>
 />
								<label for="diccoupon_no"><?php 
        echo _JLMS_NO;
        ?>
</label>
								</fieldset>
							</td>
							<td></td>
					</tr>					
					<tr>
							<td width="200"><?php 
        echo _JLMS_DISC_C_TYPE;
        ?>
:</td>
							<td>
								<fieldset class="radio">								
								<input id="diccoupon_onetime" type="radio" name="coupon_type" value="1" <?php 
        if ($row->coupon_type) {
            echo 'checked';
        }
        ?>
 />					
								<label for="diccoupon_onetime"><?php 
        echo _JLMS_DISC_ONE_TIME;
        ?>
</label>			
								<input id="diccoupon_permanent" type="radio" name="coupon_type" value="0" <?php 
        if (!$row->coupon_type) {
            echo 'checked';
        }
        ?>
 />
								<label for="diccoupon_permanent"><?php 
        echo _JLMS_DISC_PERMANENT;
        ?>
</label>
								</fieldset>
							</td>
							<td>
								<?php 
        echo _JLMS_DISC_C_TYPE_DESC;
        ?>
							
							</td>
					</tr>					
					<tr>
							<td width="200"><?php 
        echo _JLMS_DISC_TYPE;
        ?>
:</td>
							<td>
								<fieldset class="radio">								
								<input id="diccoupon_total" type="radio" name="discount_type" value="1" <?php 
        if ($row->discount_type) {
            echo 'checked';
        }
        ?>
 />
								<label for="diccoupon_total"><?php 
        echo _JLMS_TOTAL;
        ?>
</label>								
								<input id="diccoupon_percent" type="radio" name="discount_type" value="0" <?php 
        if (!$row->discount_type) {
            echo 'checked';
        }
        ?>
 />
								<label for="diccoupon_percent"><?php 
        echo _JLMS_PERCENT;
        ?>
</label>
								</fieldset>
							</td>
							<td></td>
					</tr>					
					<tr>
							<td width="200"><?php 
        echo _JLMS_DISC_VALUE;
        ?>
:</td>
							<td>								
								<input class="inputbox" type="text" name="value" size="12" maxlength="12" value="<?php 
        echo $row->value;
        ?>
" />
							</td>
							<td></td>
					</tr>
					<tr><td colspan="3">&nbsp;</td></tr>
					<tr>
						<td width="100"><?php 
        echo _JLMS_START_DATE;
        ?>
:</td>
						<td>
							<?php 
        echo JHTML::_('calendar', $row->start_date, 'start_date', 'start_date', '%Y-%m-%d', array('class' => 'text_area'));
        ?>
	
						</td>
						<td></td>
					</tr>					
					<tr>
						<td width="100"><?php 
        echo _JLMS_END_DATE;
        ?>
:</td>
						<td>
							<?php 
        echo JHTML::_('calendar', $row->end_date, 'end_date', 'end_date', '%Y-%m-%d', array('class' => 'text_area'));
        ?>
	
						</td>
						<td></td>
					</tr>														
				</table>				
				<table width="100%">
				<tr><th colspan="2">Limited to</th></tr>
				<tr>
					<td width="20%" align="left"><?php 
        echo _JLMS_USERS_GROUPS;
        ?>
:</td>
					<td width="20%" align="left"><?php 
        echo _JLMS_SUBSCRIPTIONS;
        ?>
:</td>
					<td width="60%" align="left"><?php 
        echo _JLMS_USERS;
        ?>
:</td>
				</tr>
				<tr>
					<td><?php 
        echo $lists['usergroups'];
        ?>
</td>				
					<td><?php 
        echo $lists['subscriptions'];
        ?>
</td>
					<td valign="top"><textarea name="users" cols="40" rows="9" ><?php 
        echo $row->users;
        ?>
</textarea></td>
				</tr>
				</table>				
				</fieldset>
				</div>
			</td>
		</tr>
		</table>		
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="task" value="" />		
		</form>
		<?php 
    }
    function viewCourses_blog(&$rows, &$pageNav, $option, $usertype, $lists, $levels)
    {
        global $Itemid, $JLMS_CONFIG, $my, $JLMS_DB, $acl;
        $JLMS_ACL =& JLMSFactory::getACL();
        $pres_icons = new stdClass();
        $pres_icons->mail = 0;
        $pres_icons->already = 0;
        $pres_icons->my = 0;
        $pres_icons->wl = 0;
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        //		$show_fee_col = $JLMS_CONFIG->get('show_fee_column', 1);
        $price_fee_type = $JLMS_CONFIG->get('price_fee_type', 1);
        $show_short_description = $JLMS_CONFIG->get('show_short_description', 0);
        $show_course_publish_dates = $JLMS_CONFIG->get('show_course_publish_dates', 0);
        $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
        $colspan_sh_description = 4;
        if ($show_course_publish_dates) {
            $colspan_sh_description = 6;
        }
        if (!$price_fee_type) {
            $colspan_sh_description = $colspan_sh_description - 1;
        }
        $show_course_author = $JLMS_CONFIG->get('show_course_authors', 1);
        $course_id = mosGetParam($_REQUEST, 'c_id', '');
        if ($course_id) {
            $query = "SELECT course_name FROM #__lms_courses WHERE id = '{$course_id}'";
            $JLMS_DB->setQuery($query);
            $course_name = $JLMS_DB->loadResult();
        }
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		function submitbutton(pressbutton, course_id) {
			var form = document.adminForm;
			if ( (pressbutton == 'delete_course') || (pressbutton == 'edit_course') || (pressbutton == 'export_course_pre') ) {
				form.id.value = course_id;
				form.task.value = pressbutton;
				form.submit();
			}
			else if( (pressbutton == 'enroll') && (form.boxchecked.value == '0') ){
				alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
			}
			else {
				if (pressbutton == 'enroll'){
					form.task.value = 'subscription';
					form.submit();
				}
			}
		}
		<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            ?>
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		<?php 
        }
        ?>
		//--><!]]>
		</script>

		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_COURSES_LIST, $params);
        JLMS_TMPL::ShowPageTip('courses');
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        //		echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox( $link );
        //		echo _JLMS_COURSES_FILTER." : ".$lists['courses_type'];
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo (isset($levels[0]->cat_name) && $levels[0]->cat_name != '' ? $levels[0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'] . "&nbsp;&nbsp;";
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'] . "&nbsp;&nbsp;";
        }
        JLMS_TMPL::CloseTS();
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                    echo (isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i] . "&nbsp;&nbsp;";
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        $controls = array();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=add_course"), 'title' => _JLMS_COURSES_NEW, 'img' => 'add');
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_import"), 'title' => _JLMS_COURSES_IMPORT, 'img' => 'courseimport');
            $controls[] = array('href' => 'spacer');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
        }
        //$controls[] = array('href' => "javascript:submitbutton('enroll','');", 'title' => _JLMS_ENROLL, 'img' => 'publish');
        JLMS_TMPL::OpenTS('', ' style="padding: 5px;"');
        if (JLMS_J16version()) {
            ?>
		<div class="lms_courses_blog">
			<div class="blog-featured">
				<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
				<div class="items-leading">
					<?php 
                $lead_indx = 0;
                foreach ($rows as $row) {
                    if (isset($row->leading_course) && $row->leading_course) {
                        $leading = 'leading-' . $lead_indx;
                        ?>
							<div class="<?php 
                        echo $leading;
                        ?>
">
								<h2>
									<a href="<?php 
                        echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
										<?php 
                        echo $row->course_name;
                        ?>
									</a>
									<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
									<div class="clr"><!-- --></div>
								</h2>
								<dl class="article-info">
									<?php 
                        if ($show_course_author) {
                            ?>
										<dd class="createdby">
											<?php 
                            echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                            ?>
										</dd>
										<?php 
                        }
                        ?>
								</dl>
								<?php 
                        echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                        ?>
								<div class="item-separator"><!-- --></div>
							</div>
							<?php 
                        $lead_indx++;
                    }
                }
                ?>
				</div>
				<?php 
            }
            $class = 'items-row';
            $cols_class = 'cols-' . $lists['menu_params']->get('num_columns', 2);
            $row_class = 'row-0';
            $class = $class . ' ' . $cols_class . ' ' . $row_class;
            ?>
				<div class="<?php 
            echo $class;
            ?>
">
				<?php 
            $n = 1;
            for ($i = 0; $i < count($rows); $i++) {
                $row = $rows[$i];
                if (!isset($row->leading_course) || !$row->leading_course) {
                    ?>
					
						<?php 
                    $column_class = 'item';
                    $column_class .= ' ' . 'column-' . $n;
                    ?>
						<div class="<?php 
                    echo $column_class;
                    ?>
">
							<h2>
								<a href="<?php 
                    echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                    ?>
" title="<?php 
                    echo $row->course_name;
                    ?>
">
									<?php 
                    echo $row->course_name;
                    ?>
								</a>
								<?php 
                    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                    $_JLMS_PLUGINS->loadBotGroup('system');
                    $plugin_args = array();
                    $plugin_args[] = $row->id;
                    $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                    ?>
								<div class="clr"><!-- --></div>
							</h2>
							<dl class="article-info">
								<?php 
                    if ($show_course_author) {
                        ?>
									<dd class="createdby">
										<?php 
                        echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                        ?>
									</dd>
									<?php 
                    }
                    ?>
							</dl>
							
							<?php 
                    echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                    ?>
							<div class="item-separator"><!-- --></div>
						</div>
						<?php 
                    if ($lists['menu_params']->get('num_columns', 2) == $n) {
                        ?>
							<span class="row-separator"><!-- --></span>
							<?php 
                        $n = 1;
                    } else {
                        $n++;
                    }
                }
            }
            ?>
				</div>
			</div>
		</div>
		<?php 
        } else {
            ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
			<tr>
				<td colspan="<?php 
                echo is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
                ?>
" valign="top">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $row = $rows[$x];
                    if (isset($row->leading_course) && $row->leading_course) {
                        ?>
							<div class="course_info">
								<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td class="contentheading">
											<a href="<?php 
                        echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
												<?php 
                        echo $row->course_name;
                        ?>
											</a>
										</td>
									</tr>
								</table>
								<?php 
                        if ($show_course_author) {
                            ?>
								<div class="course_author">
									<span class="small"><?php 
                            echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                            ?>
</span>
								</div>
								<?php 
                        }
                        ?>
								<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
								<div class="course_sh_dsc">
									<?php 
                        echo $row->course_sh_description;
                        ?>
								</div>
							</div>
							<span class="article_separator">&nbsp;</span>
							<?php 
                    }
                }
                ?>
				</td>
			</tr>
			<?php 
            }
            ?>
	
			<tr>
				<?php 
            $divider = '';
            $menu_params_columns = is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
            for ($z = 0; $z < $menu_params_columns; $z++) {
                if ($z > 0) {
                    $divider = ' column_separator';
                }
                ?>
				<td class="article_column<?php 
                echo $divider;
                ?>
" valign="top" width="<?php 
                echo intval(100 / $menu_params_columns);
                ?>
%">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $n = $x * $menu_params_columns + $z;
                    if (isset($rows[$n])) {
                        $row = $rows[$n];
                        if (!isset($row->leading_course) || !$row->leading_course) {
                            ?>
								<div class="course_info">
									<table width="100%" cellpadding="0" cellspacing="0" border="0">
										<tr>
											<td class="contentheading">
												<a href="<?php 
                            echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                            ?>
" title="<?php 
                            echo $row->course_name;
                            ?>
">
													<?php 
                            echo $row->course_name;
                            ?>
												</a>
											</td>
										</tr>
									</table>
									<?php 
                            if ($show_course_author) {
                                ?>
									<div class="course_author">
										<span class="small"><?php 
                                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                                ?>
</span>
									</div>
									<?php 
                            }
                            ?>
									<?php 
                            $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                            $_JLMS_PLUGINS->loadBotGroup('system');
                            $plugin_args = array();
                            $plugin_args[] = $row->id;
                            $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                            ?>
									<div class="course_sh_dsc">
										<?php 
                            echo $row->course_sh_description;
                            ?>
									</div>
								</div>
								<span class="article_separator">&nbsp;</span>
								<?php 
                        }
                    }
                }
                ?>
				</td>
				<?php 
            }
            ?>
			</tr>
		</table>
	<?php 
        }
        ?>
	
	<center>
	<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo _JLMS_PN_DISPLAY_NUM . ' ' . $pageNav->getLimitBox($link);
        echo $pageNav->writePagesCounter();
        ?>
	</center>
	<center>
		<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo $pageNav->writePagesLinks($link);
        ?>
	</center>
	<?php 
        JLMS_TMPL::CloseTS();
        if ($pres_icons->already || $pres_icons->mail || $pres_icons->my || $pres_icons->wl) {
            JLMS_TMPL::OpenTS('', ' align="left"');
            ?>
			<div class="joomlalms_info_legend">
			<?php 
            if ($pres_icons->already) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_complete.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" title="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->mail) {
                ?>
				<div style="text-align:left ">
					<img class='JLMS_png' src="<?php 
                echo $lms_img_path;
                ?>
/dropbox/dropbox_corr.png" align="top" width='16' height='16' border='0' alt='' title='' />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ADMIN_SENT;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->my) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_courses.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->wl) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_waiting.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_IN_WL;
                ?>
.
				</div>
			<?php 
            }
            ?>
			</div>
	<?php 
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::CloseMT();
        ?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="itemid" value="" />
		<input type="hidden" name="row_id" value="0" />
	</form>
	<?php 
    }
示例#10
0
    function showCoursesForGuest_blog($option, &$lists, &$rows, &$pageNav, $enrollment)
    {
        global $Itemid, $JLMS_CONFIG;
        //		$show_fee_col = $JLMS_CONFIG->get('show_fee_column');
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        $show_paid_courses = $JLMS_CONFIG->get('show_paid_courses', 1);
        $show_course_author = $JLMS_CONFIG->get('show_course_authors', 1);
        $price_fee_type = $JLMS_CONFIG->get('price_fee_type', 1);
        $show_short_description = $JLMS_CONFIG->get('show_short_description', 0);
        $show_course_publish_dates = $JLMS_CONFIG->get('show_course_publish_dates', 0);
        $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
        $colspan_sh_description = 4;
        if ($show_course_publish_dates) {
            $colspan_sh_description = 6;
        }
        if (!$price_fee_type) {
            $colspan_sh_description = $colspan_sh_description - 1;
        }
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		
	<?php 
        if ($enrollment) {
            ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($lists['levels']);
            ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($lists['levels']);
            ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		//--><!]]>
		</script>
	<?php 
        }
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        JLMS_showTopMenu_simple($option);
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS('', ' align="left"');
        echo JLMS_ShowText_WithFeatures($lists['homepage_text']);
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
            echo (isset($lists['levels'][0]->cat_name) && $lists['levels'][0]->cat_name != '' ? $lists['levels'][0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'] . "&nbsp;&nbsp;";
            JLMS_TMPL::CloseTS();
        } else {
            JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'] . "&nbsp;&nbsp;";
            JLMS_TMPL::CloseTS();
        }
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                    echo (isset($lists['levels'][$i]->cat_name) && $lists['levels'][$i]->cat_name != '' ? $lists['levels'][$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i] . "&nbsp;&nbsp;";
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        JLMS_TMPL::OpenTS('', ' style="padding: 5px;"');
        if (JLMS_J16version()) {
            ?>
			<div class="lms_courses_blog">
				<div class="blog-featured">
					<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
					<div class="items-leading">
						<?php 
                $lead_indx = 0;
                foreach ($rows as $row) {
                    if (isset($row->leading_course) && $row->leading_course) {
                        $leading = 'leading-' . $lead_indx;
                        ?>
								<div class="<?php 
                        echo $leading;
                        ?>
">
									<h2>
										<a href="<?php 
                        echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
											<?php 
                        echo $row->course_name;
                        ?>
										</a>
										<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
										<div class="clr"><!-- --></div>
									</h2>
									<dl class="article-info">
										<?php 
                        if ($show_course_author) {
                            ?>
											<dd class="createdby">
												<?php 
                            echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                            ?>
											</dd>
											<?php 
                        }
                        ?>
									</dl>
									<?php 
                        echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                        ?>
									<div class="item-separator"><!-- --></div>
								</div>
								<?php 
                        $lead_indx++;
                    }
                }
                ?>
					</div>
					<?php 
            }
            $class = 'items-row';
            $cols_class = 'cols-' . $lists['menu_params']->get('num_columns', 2);
            $row_class = 'row-0';
            $class = $class . ' ' . $cols_class . ' ' . $row_class;
            ?>
					<div class="<?php 
            echo $class;
            ?>
">
					<?php 
            $n = 1;
            for ($i = 0; $i < count($rows); $i++) {
                $row = $rows[$i];
                if (!isset($row->leading_course) || !$row->leading_course) {
                    ?>
						
							<?php 
                    $column_class = 'item';
                    $column_class .= ' ' . 'column-' . $n;
                    ?>
							<div class="<?php 
                    echo $column_class;
                    ?>
">
								<h2>
									<a href="<?php 
                    echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                    ?>
" title="<?php 
                    echo $row->course_name;
                    ?>
">
										<?php 
                    echo $row->course_name;
                    ?>
									</a>
									<?php 
                    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                    $_JLMS_PLUGINS->loadBotGroup('system');
                    $plugin_args = array();
                    $plugin_args[] = $row->id;
                    $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                    ?>
									<div class="clr"><!-- --></div>
								</h2>
								<dl class="article-info">
									<?php 
                    if ($show_course_author) {
                        ?>
										<dd class="createdby">
											<?php 
                        echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                        ?>
										</dd>
										<?php 
                    }
                    ?>
								</dl>
								
								<?php 
                    echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                    ?>
								<div class="item-separator"><!-- --></div>
							</div>
							<?php 
                    if ($lists['menu_params']->get('num_columns', 2) == $n) {
                        ?>
								<span class="row-separator"><!-- --></span>
								<?php 
                        $n = 1;
                    } else {
                        $n++;
                    }
                }
            }
            ?>
					</div>
				</div>
			</div>
			<?php 
        } else {
            ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
			<tr>
				<td colspan="<?php 
                echo $lists['menu_params']->get('num_columns', 2);
                ?>
" valign="top">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $row = $rows[$x];
                    if (isset($row->leading_course) && $row->leading_course) {
                        ?>
							<div class="course_info">
								<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td class="contentheading">
											<a href="<?php 
                        echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
												<?php 
                        echo $row->course_name;
                        ?>
											</a>
										</td>
									</tr>
								</table>
								<?php 
                        if ($show_course_author) {
                            ?>
								<div class="course_author">
									<span class="small"><?php 
                            echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                            ?>
</span>
								</div>
								<?php 
                        }
                        ?>
								<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
								<div class="course_sh_dsc">
									<?php 
                        echo $row->course_sh_description;
                        ?>
								</div>
							</div>
							<span class="article_separator">&nbsp;</span>
							<?php 
                    }
                }
                ?>
				</td>
			</tr>
			<?php 
            }
            ?>
			<tr>
				<?php 
            $divider = '';
            for ($z = 0; $z < $lists['menu_params']->get('num_columns', 2); $z++) {
                if ($z > 0) {
                    $divider = ' column_separator';
                }
                ?>
				<td class="article_column<?php 
                echo $divider;
                ?>
" valign="top" width="<?php 
                echo intval(100 / $lists['menu_params']->get('num_columns'));
                ?>
%">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $n = $x * $lists['menu_params']->get('num_columns', 2) + $z;
                    if (isset($rows[$n])) {
                        $row = $rows[$n];
                        if (!isset($row->leading_course) || !$row->leading_course) {
                            ?>
								<div class="course_info">
									<table width="100%" cellpadding="0" cellspacing="0" border="0">
										<tr>
											<td class="contentheading">
												<a href="<?php 
                            echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                            ?>
" title="<?php 
                            echo $row->course_name;
                            ?>
">
													<?php 
                            echo $row->course_name;
                            ?>
												</a>
											</td>
										</tr>
									</table>
									<?php 
                            if ($show_course_author) {
                                ?>
									<div class="course_author">
										<span class="small"><?php 
                                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                                ?>
</span>
									</div>
									<?php 
                            }
                            ?>
									<?php 
                            $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                            $_JLMS_PLUGINS->loadBotGroup('system');
                            $plugin_args = array();
                            $plugin_args[] = $row->id;
                            $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                            ?>
									<div class="course_sh_dsc">
										<?php 
                            echo $row->course_sh_description;
                            ?>
									</div>
								</div>
								<span class="article_separator">&nbsp;</span>
								<?php 
                        }
                    }
                }
                ?>
				</td>
				<?php 
            }
            ?>
			</tr>
		</table>
		<?php 
        }
        ?>
		<center>
		<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo _JLMS_PN_DISPLAY_NUM . ' ' . $pageNav->getLimitBox($link);
        echo $pageNav->writePagesCounter();
        ?>
		</center>
		<center>
			<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo $pageNav->writePagesLinks($link);
        ?>
		</center>
		<?php 
        JLMS_TMPL::CloseTS();
        ?>
		</table>
			<input type="hidden" name="task" value="subscription" />
			<input type="hidden" name="id" value="" />
			<input type="hidden" name="boxchecked" value="0" />
		</form>
		<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
示例#11
0
    function editItem(&$row, &$lists, $option)
    {
        ?>

<script language="javascript" type="text/javascript">
<!--
function jlms_changeUserSelect(c_e) {
	var sel_value = c_e.options[c_e.selectedIndex].value;
	var sel1 = c_e.form.user_name;
	for (var i = 0; i < sel1.options.length; i++) {
		if (sel1.options[i].value == sel_value) {
			sel1.options[i].selected = true;
		}
	}
	var sel2 = c_e.form.user_email;
	for (var i = 0; i < sel2.options.length; i++) {
		if (sel2.options[i].value == sel_value) {
			sel2.options[i].selected = true;
		}
	}
	var sel3 = c_e.form.user_id;
	for (var i = 0; i < sel3.options.length; i++) {
		if (sel3.options[i].value == sel_value) {
			sel3.options[i].selected = true;
		}
	}
}
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if (pressbutton == 'cancel') {
		form.page.value = pressbutton;
		form.submit();
		return;
	}
	var sel_value = form.<?php 
        echo $lists['view_by'] ? 'role_id' : 'lms_usertype_id';
        ?>
.options[form.<?php 
        echo $lists['view_by'] ? 'role_id' : 'lms_usertype_id';
        ?>
.selectedIndex].value;
<?php 
        if (!$lists['user_id']) {
            echo '	var sel_user = form.user_id.options[form.user_id.selectedIndex].value;';
        }
        ?>
	if (sel_value == 0 || sel_value == '0') {
		alert('<?php 
        echo _JLMS_USERS_SCLT_USR_ROLE;
        ?>
')
<?php 
        if (!$lists['user_id']) {
            echo '	} else if (sel_user == 0 || sel_user == \'0\') {' . "\n";
            echo '	alert(\'' . _JLMS_USERS_SCLT_USR . '\');';
        }
        ?>
	} else {
		form.page.value = pressbutton;
		form.submit();
		return;
	}
}

<?php 
        if (JLMS_J16version()) {
            ?>
Joomla.submitbutton = submitbutton;
<?php 
        }
        ?>
//-->
</script>
		<form action="index.php" method="post" name="adminForm">		
		<table width="100%" >
			<tr>
				<td valign="top" width="220px">
				<div>
					<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
				</div>
				</td>
				<td valign="top">
			<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
				<table class="adminheading">
				<tr>
					<th class="user">
					<?php 
            echo _JOOMLMS_COMP_NAME;
            ?>
:
					<small>
					<?php 
            echo $row->id ? _JLMS_USERS_EDIT_USER : _JLMS_USERS_NEW_USER;
            ?>
					</small>
					</th>
				</tr>
				</table>
			<?php 
        }
        ?>
				<div class="width-100">
				<fieldset class="adminform">
				<table width="100%" border="0">
					<tr>
						<td valign="top">
							<table width="100%" >
								<tr>
									<th colspan="2"><?php 
        echo _JLMS_USERS_USR_DETS;
        ?>
</th>
								<tr>
							<?php 
        if ($lists['user_id']) {
            ?>
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USER;
            ?>
:</td>
									<td><?php 
            echo $lists['user_info'];
            ?>
</td>
								</tr>
							<?php 
        } else {
            ?>
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USERS_SLCT_USRNAME;
            ?>
:</td>
									<td><?php 
            echo $lists['users'];
            ?>
</td>
								</tr>
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USERS_OR_NAME;
            ?>
:</td>
									<td><?php 
            echo $lists['users_names'];
            ?>
</td>
								</tr>
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USERS_OR_EMAIL;
            ?>
:</td>
									<td><?php 
            echo $lists['users_emails'];
            ?>
</td>
								</tr>
							<?php 
        }
        ?>
								<tr>
									<td align="right" width="20%"><?php 
        echo _JLMS_USERS_USER_ROLE;
        ?>
:</td>
									<td><?php 
        echo $lists['roles'];
        ?>
</td>
								</tr>
								<?php 
        if ($lists['view_by']) {
            ?>
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USERS_CRS_NAME;
            ?>
:</td>
									<td><?php 
            echo $lists['course_name'];
            ?>
</td>
								</tr>
								<?php 
        }
        ?>
							</table>
							<br />
						</td>
					</tr>
				</table>
				</fieldset>
				</div>
		</td></tr></table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="task" value="lms_users" />
		<input type="hidden" name="course_id" value="<?php 
        echo $lists['course_id'];
        ?>
" />
		<input type="hidden" name="view_by" value="<?php 
        echo $lists['view_by'];
        ?>
" />
<?php 
        if ($lists['user_id']) {
            ?>
		<input type="hidden" name="user_id" value="<?php 
            echo $lists['user_id'];
            ?>
" />
<?php 
        }
        ?>
		<input type="hidden" name="page" value="" />		
		</form>
		<?php 
    }
 function register($from_cb = 0, $freeCourse = false)
 {
     global $Itemid, $JLMS_DB, $JLMS_CONFIG, $JLMS_SESSION, $version, $task, $my;
     $reg_success = false;
     $msg = '';
     $username = JRequest::getVar('username');
     $password = JRequest::getVar('password');
     $usersConfig =& JComponentHelper::getParams('com_users');
     $app =& JFactory::getApplication();
     if ($from_cb) {
         global $task;
         $task = 'saveregisters';
         $_REQUEST['task'] = 'saveregisters';
         $_GET['task'] = 'saveregisters';
         $_POST['task'] = 'saveregisters';
         JRequest::setVar('task', $task);
         ob_start();
         global $ueConfig;
         $_CB_joomla_adminpath = $JLMS_CONFIG->get('absolute_path') . "/administrator";
         $_CB_adminpath = $_CB_joomla_adminpath . "/components/com_comprofiler";
         include_once $_CB_adminpath . "/ue_config.php";
         if ($usersConfig->get('allowUserRegistration')) {
             $allowUserRegistration = true;
         } else {
             $allowUserRegistration = false;
         }
         // check if CB registration is allowed
         if (!$allowUserRegistration && (!isset($ueConfig['reg_admin_allowcbregistration']) || $ueConfig['reg_admin_allowcbregistration'] != '1') || $my->id) {
             $msg = _JLMS_REGISTRATION_DISABLED;
             $reg_success = false;
         } else {
             $existingUser = null;
             $query = "SELECT * " . "\n FROM #__users u " . "\n WHERE u.username = '******'";
             $JLMS_DB->setQuery($query);
             $existingUser = $JLMS_DB->loadObjectList();
             // new registration will be failed if user with such username is already exists.
             if (isset($existingUser[0])) {
                 $reg_success = false;
             }
             require_once JPATH_SITE . '/components/com_comprofiler/comprofiler.html.php';
             require_once JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
             $msg = @ob_get_contents();
             $msg = str_replace('<br />', '**br**', $msg);
             $msg = str_replace('</div><div', '**br**', $msg);
             $msg = strip_tags($msg);
             $msg = str_replace('**br**', '<br />', $msg);
             $msg = trim($msg);
             if (substr($msg, 0, 6) == 'alert(') {
                 preg_match('`alert\\(\'(.*)\'\\);(.*)`isU', $msg, $matches2);
                 # <script...>(#our_content#)</script> areas
                 if (isset($matches2[1])) {
                     $msg = $matches2[1];
                 }
             }
             @ob_end_clean();
             $filter =& JFilterInput::getInstance();
             if ($filter->clean($msg) == $filter->clean(_UE_REG_COMPLETE)) {
                 $msg = '';
                 $reg_success = true;
             }
         }
     } else {
         if (JLMS_Jversion() == 2) {
             if (JLMS_J16version()) {
                 $lang =& JFactory::getLanguage();
                 $lang->load('com_users');
                 require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'models' . DS . 'registration.php';
                 // Create the controller
                 $model = new UsersModelRegistration();
                 $requestData = JRequest::getVar('jform', array(), 'post', 'array');
                 $username = $requestData['username'];
                 $password = $requestData['password1'];
                 JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
                 JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields');
                 $form = $model->getForm();
                 $return = $model->validate($form, $requestData);
                 // Save the data in the session.
                 if ($return === false) {
                     $errors = $model->getErrors();
                     // Push up to three validation messages out to the user.
                     for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
                         $msg .= '<br />' . $errors[$i];
                     }
                     $app->setUserState('users.registration.form.data', $requestData);
                 } else {
                     $return = $model->register($requestData);
                     if ($return === false) {
                         $msg .= '<br />' . JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError());
                         $app->setUserState('users.registration.form.data', $requestData);
                     }
                 }
                 if ($return === 'adminactivate') {
                     $reg_complete_activate_found = true;
                 } else {
                     if ($return === 'useractivate') {
                         $reg_complete_activate_found = true;
                     } else {
                         if ($return !== false) {
                             $reg_success = true;
                             $reg_complete_found = true;
                         }
                     }
                 }
             } else {
                 $lang =& JFactory::getLanguage();
                 $lang->load('com_user');
                 require_once JPATH_SITE . '/components/com_user/controller.php';
                 require_once JPATH_SITE . '/components/com_user/views/register/view.html.php';
                 // Create the controller
                 $controller = new UserController();
                 $controller->_basePath = JPATH_SITE . '/components/com_user';
                 ob_start();
                 $controller->execute('register_save');
                 ob_end_clean();
                 $t = JError::getError(true);
                 $reg_complete_found = false;
                 $reg_complete_activate_found = false;
                 // this variable is not used yet... for future
                 if (isset($t->message) && $t->message == JText::_('REG_COMPLETE')) {
                     $reg_success = true;
                     $reg_complete_found = true;
                 } elseif (isset($t->message) && $t->message == JText::_('REG_COMPLETE_ACTIVATE')) {
                     $reg_complete_activate_found = true;
                 } elseif (isset($controller->_message) && $controller->_message == JText::_('REG_COMPLETE')) {
                     $reg_success = true;
                     $reg_complete_found = true;
                 } elseif (isset($controller->_message) && $controller->_message == JText::_('REG_COMPLETE_ACTIVATE')) {
                     $reg_complete_activate_found = true;
                 }
             }
         }
     }
     $login_success = false;
     if ($reg_success) {
         $login_success = JLMS_UserSessions::doLogin($username, $password);
     }
     $app->set('_messageQueue', null);
     if ($reg_success && $login_success) {
         if ($freeCourse) {
             $msg .= '<br />' . _JLMS_REGISTRATION_COMPLETE . "<br />" . _JLMS_LOGIN_SUCCESS . "<br />" . _JLMS_SUBSCRIBE_CONTINUE;
         } else {
             $msg .= '<br />' . _JLMS_REGISTRATION_COMPLETE . "<br />" . _JLMS_LOGIN_SUCCESS . "<br />";
         }
     } elseif ($reg_success) {
         $msg .= '<br />' . _JLMS_REGISTRATION_COMPLETE;
     } else {
         if ($usersConfig->get('useractivation') && !$reg_success) {
             $msg .= '<br />' . _JLMS_REGISTRATION_ACTIVATION;
         }
     }
     return $msg;
 }
    function editItem(&$row, &$lists, $option, $redirect, $rows_groups)
    {
        ?>
	<script type="text/javascript">
	<!--
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			form.page.value = pressbutton;
			form.submit();
			return;
		}
		var group_value = form.group_id.value;
		var user_value = form.user_id.value;
		
		if (group_value == 0) {
			alert( '<?php 
        echo _JLMS_USERS_MSG_SLCT_ROLE;
        ?>
' )
		}
		else if (user_value == 0) {
			alert('<?php 
        echo _JLMS_USERS_MSG_SLCT_USER;
        ?>
');
		}
		else {
			form.page.value = pressbutton;
			form.submit();
			return;
		}
	}
	
	<?php 
        if (JLMS_J16version()) {
            ?>
	Joomla.submitbutton = submitbutton;
	<?php 
        }
        ?>
	//-->
	</script>		
		<form action="index.php" method="post" name="adminForm">		
		<table width="100%" >
			<tr>
				<td valign="top" width="220px">
				<div>
					<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
				</div>
				</td>
				<td valign="top">
				<div class="width-100">
				<fieldset class="adminform">
			<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
				<table class="adminheading">
				<tr>
					<th class="user">
					<?php 
            echo _JOOMLMS_COMP_NAME;
            ?>
:
					<small>
					<?php 
            echo $row->user_id ? _JLMS_USERS_EDIT_MNGR : _JLMS_USERS_NEW_MNGR;
            ?>
					</small>
					</th>
				</tr>
				</table>
			<?php 
        }
        ?>
			
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td valign="top">
							<table width="100%" >
								<tr>
									<th colspan="2"><?php 
        echo _JLMS_USERS_USR_DETS;
        ?>
</th>
								<tr>
							<?php 
        if ($row->user_id) {
            ?>
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USER;
            ?>
:</td>
									<td><?php 
            echo $row->username . ' , ' . $row->name . '(' . $row->email . ')';
            ?>
</td>
								</tr>
							<?php 
        }
        ?>
	
								<tr>
									<td align="right" width="20%"><?php 
        echo _JLMS_USERS_SLCT_USR_GR;
        ?>
:</td>
									<td><?php 
        echo $lists['ug_names'];
        ?>
</td>
								</tr>
							<?php 
        if (!$row->user_id) {
            ?>
	
								<tr>
									<td align="right" width="20%"><?php 
            echo _JLMS_USERS_SLCT_USR;
            ?>
:</td>
									<td><?php 
            echo $lists['users_names'];
            ?>
</td>
								</tr>
							<?php 
        }
        ?>
	
							</table>
						</td>
					</tr>
					<?php 
        if (count($rows_groups)) {
            ?>
	
					<tr>
						<td valign="top">
							<table class="adminlist">
								<thead>
									<tr>
										<th class="title" width="100%"><?php 
            echo _JLMS_USERS_MANGD_GR_LIST;
            ?>
</th>
									</tr>
								</thead>
								<?php 
            $k = 0;
            for ($i = 0, $n = count($rows_groups); $i < $n; $i++) {
                $row1 = $rows_groups[$i];
                ?>
									<tr class="<?php 
                echo "row{$k}";
                ?>
">
										<td align="left">
											<?php 
                echo $row1->ug_name;
                ?>
										</td>
									</tr>
									<?php 
                $k = 1 - $k;
            }
            ?>
	
							</table>	
						</td>
					</tr>
					<?php 
        }
        ?>
				</table>
		</td></tr>
		
		</table>
	<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
	<input type="hidden" name="task" value="group_managers" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="hidemainmenu" value="0" />
	<input type="hidden" name="page" value="" />
	<input type="hidden" name="redirect" value="<?php 
        echo $redirect;
        ?>
" />
	
	<?php 
        if ($row->user_id) {
            ?>
	
		<input type="hidden" name="user_id" value="<?php 
            echo $row->user_id;
            ?>
" />
		<input type="hidden" name="old_group_id" value="<?php 
            echo $row->group_id;
            ?>
" />
		<input type="hidden" name="edit_manager" value="1" />
	<?php 
        }
        ?>
	</fieldset>
	</div>
	</form>
		<?php 
    }
示例#14
0
 function &getChildInstance($id = 'Joomla')
 {
     static $instances;
     if (!isset($instances)) {
         $instances = array();
     }
     if (empty($instances[$id])) {
         $conf =& JFactory::getConfig();
         $sendmail = $conf->getValue('config.sendmail');
         if (JLMS_J16version()) {
             $smtpauth = $conf->get('smtpauth') == 0 ? null : 1;
         } else {
             $smtpauth = $conf->getValue('config.smtpauth');
         }
         $smtpuser = $conf->getValue('config.smtpuser');
         $smtppass = $conf->getValue('config.smtppass');
         $smtphost = $conf->getValue('config.smtphost');
         $smtpsecure = $conf->getValue('config.smtpsecure');
         $smtpport = $conf->getValue('config.smtpport');
         $mailfrom = $conf->getValue('config.mailfrom');
         $fromname = $conf->getValue('config.fromname');
         $mailer = $conf->getValue('config.mailer');
         $instance = new MailManager();
         // Set default sender
         $instance->setSender(array($mailfrom, $fromname));
         // Default mailer is to use PHP's mail function
         switch ($mailer) {
             case 'smtp':
                 $instance->useSMTP($smtpauth, $smtphost, $smtpuser, $smtppass, $smtpsecure, $smtpport);
                 break;
             case 'sendmail':
                 $instance->useSendmail($sendmail);
                 break;
             default:
                 $instance->IsMail();
                 break;
         }
         $instances[$id] = $instance;
     }
     return $instances[$id];
 }
示例#15
0
    function editItem(&$row, &$lists, &$text_permisions, &$permissions, $option)
    {
        global $is_jlms_trial_roles_heading_text;
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				form.page.value = pressbutton;
				form.submit();
				return;
			}
			var sel_value = form.roletype_id.options[form.roletype_id.selectedIndex].value;
			var role_name = form.lms_usertype.value;
			if (sel_value == 0 || sel_value == '0') {
				alert('<?php 
        echo _JLMS_ROLES_MSG_SELECT_ROLE_TYPE;
        ?>
')
			} else if (!role_name) {
				alert( '<?php 
        echo _JLMS_ROLES_MSG_ENTER_ROLE_NAME;
        ?>
' )
			} else {
				form.page.value = pressbutton;
				form.submit();
				return;
			}
		}
		
		<?php 
        if (JLMS_J16version()) {
            ?>
		Joomla.submitbutton = submitbutton;
		<?php 
        }
        ?>
		
		//extra BrustersIceCream
//		function JLMS_ceostore_trigger(e){
//			var form = document.adminForm;
//
//			if(e.checked && e.name == 'permissions[ceo][store_manager]'){
//				form['permissions[ceo][corporate_admin]'][0].checked = true;
//				form['permissions[ceo][corporate_admin]'][1].checked = false;
//			}
//			if(e.checked && e.name == 'permissions[ceo][corporate_admin]'){
//				form['permissions[ceo][store_manager]'][0].checked = true;
//				form['permissions[ceo][store_manager]'][1].checked = false;
//			}
//		}
		//-->
		</script>
		<form action="index.php" method="post" name="adminForm">		
		<table width="100%" >
			<tr>
				<td valign="top" width="220px">
					<div>
						<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
					</div>
					</td>
					<td valign="top">
					<div class="width-100">
					<fieldset class="adminform">
					<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
						<table class="adminheading">
						<tr>
							<th class="user">
							<?php 
            echo _JOOMLMS_COMP_NAME;
            ?>
:
							<small>
							<?php 
            echo $row->id ? _JLMS_ROLES_EDIT_USER_ROLE : _JLMS_ROLES_NEW_USER_ROLE;
            echo $is_jlms_trial_roles_heading_text ? $is_jlms_trial_roles_heading_text : '';
            ?>
							</small>
							</th>
						</tr>
						</table>
					<?php 
        }
        ?>
									
					<table width="100%" border="0">
						<tr>
							<td valign="top">
								<table width="100%" >
									<tr>
										<th colspan="2"><?php 
        echo _JLMS_ROLES_USER_ROLE_DETAILS;
        ?>
</th>
									<tr>
									<tr>
										<td align="right" width="20%"><?php 
        echo _JLMS_ROLES_EDIT_ROLE_NAME;
        ?>
:</td>
										<td><input type="text" name="lms_usertype" class="text_area" style="width:266px;" value="<?php 
        echo $row->lms_usertype;
        ?>
" /></td>
									</tr>
									<tr>
										<td align="right" width="20%"><?php 
        echo _JLMS_ROLES_EDIT_ROLE_TYPE;
        ?>
:</td>
										<td><?php 
        echo $lists['role_type'];
        ?>
</td>
									</tr>
									<?php 
        if ($row->roletype_id == 2 || $row->roletype_id == 1) {
            ?>
									<tr>
										<td>
											Default Role:
										</td>
										<td>
											<table>
												<tr>
													<td>
														<input type="radio" name="default_role" value="0" <?php 
            echo isset($row->default_role) && $row->default_role ? '' : 'checked="checked"';
            ?>
 />
													</td>
													<td>
														<?php 
            echo _JLMS_NO;
            ?>
													</td>
													<td>
														<input type="radio" name="default_role" value="1" <?php 
            echo isset($row->default_role) && $row->default_role ? 'checked="checked"' : '';
            ?>
 />
													</td>
													<td>
														<?php 
            echo _JLMS_YES;
            ?>
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<?php 
        }
        ?>
								</table>
								<br />
							</td>
						</tr>
					</table>
					<table width="100%" border="0">
						<tr>
							<td valign="top">
								<table width="100%" >
									<tr>
										<th><?php 
        echo _JLMS_ROLES_ROLE_PERM;
        ?>
</th>
									</tr>
									<tr>
										<td>
										<?php 
        if (count($permissions)) {
            $old_key = '';
            foreach ($permissions as $key => $tmp_prms) {
                if ($key != $old_key) {
                    $onclick_ceo_check = '';
                    /*if($key == 'ceo'){
                    			$onclick_ceo_check = 'onclick="JLMS_ceostore_trigger(this);"';
                    		}*/
                    ?>
													<fieldset>
														<legend>
															<?php 
                    echo strtoupper($key);
                    ?>
														</legend>
														<table >
														<?php 
                    $tmp_step_permisions = $tmp_prms;
                    $k = 1;
                    foreach ($tmp_step_permisions as $text_prms => $tmp_step_prms) {
                        ?>
															<tr class="row<?php 
                        echo $k;
                        ?>
">
																<td width="20%">
																	<?php 
                        $text_info_permission = isset($text_permisions[$key]->{$text_prms}) ? $text_permisions[$key]->{$text_prms} : '<i>' . $text_prms . '</i>';
                        echo $text_info_permission . ':';
                        ?>
																</td>
																<td>
																	<table>
																		<tr>
																			<td>
																				<input type="radio" <?php 
                        echo $onclick_ceo_check;
                        ?>
 name="<?php 
                        echo 'permissions' . '[' . $key . ']' . '[' . $text_prms . ']';
                        ?>
" value="0" <?php 
                        echo isset($tmp_step_prms) && $tmp_step_prms ? '' : 'checked="checked"';
                        ?>
 />
																			</td>
																			<td>
																				<?php 
                        echo _JLMS_NO;
                        ?>
																			</td>
																			<td>
																				<input type="radio" <?php 
                        echo $onclick_ceo_check;
                        ?>
 name="<?php 
                        echo 'permissions' . '[' . $key . ']' . '[' . $text_prms . ']';
                        ?>
" value="1" <?php 
                        echo isset($tmp_step_prms) && $tmp_step_prms ? 'checked="checked"' : '';
                        ?>
 />
																			</td>
																			<td>
																				<?php 
                        echo _JLMS_YES;
                        ?>
																			</td>
																		</tr>
																	</table>
																</td>
															</tr>
															<?php 
                        $k = 1 - $k;
                    }
                    ?>
														</table>
													</fieldset>
													<?php 
                }
                $old_key = $key;
            }
        } else {
            echo _JLMS_ROLES_MSG_SLCT_ROLE_T;
        }
        ?>
										</td>
									</tr>
								</table>
								<br />
							</td>
						</tr>
					</table>	
					</fieldset>
					</div>			
				</td>
			</tr>
		</table>	
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="task" value="lms_roles" />
		<input type="hidden" name="page" value="" />		
		</form>
		<?php 
    }