getVar('uname'); $xoopsUID = $GLOBALS['xoopsUser']->getVar('uid'); } else { $xoopsUname = 'nosuchaname123'; $xoopsUID = 0; } if ($xoopsUname=='') $xoopsUname='nosuchaname123'; if (isset($_REQUEST["gid"])) { $gid = $_REQUEST["gid"]; } else { // redirect; header("location: ". XOOPS_URL."/modules/graduate/grads_index.php"); exit ; } //Get the section object and its data $gradsObj = $grads_obj_Handler->get($gid); if (count($gradsObj)==0 || !$gradsObj->getVar('grads_online')){ header("location: ". XOOPS_URL."/modules/graduate/grads_index.php"); exit ; } $groupPermHandler =& xoops_gethandler('groupperm'); $module = $module_handler->getByDirname('graduate'); ($xoopsUser) ? $groups = $xoopsUser->getGroups() : $groups = XOOPS_GROUP_ANONYMOUS; $islocaladmin=$groupPermHandler->checkRight("content_admin", NULL, $groups, $module->getVar("mid")); $xoopsTpl->assign('islocaladmin',$islocaladmin); $unameID = $gradsObj->getVar("uname"); $is_owner=($unameID==$xoopsUID || $xoopsUname == $gradsObj->getVar('login_name')); $xoopsTpl->assign('is_owner', $is_owner); $cid = $gradsObj->getVar("cid"); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('topic_online', 1, '=')); $criteria->setSort('topic_weight'); $allTopics=$tree_obj_handler->getObjects($criteria); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topic_allparent = objectToArray(array_reverse($topic_tree -> getAllParent($cid))); $xoopsTpl->assign('topic_allparent', $topic_allparent); $topic = objectToArrayNoKey($topic_tree -> getByKey($cid)); $xoopsTpl->assign('topic', $topic); $grads=objectToArrayNoKey($gradsObj); //$fid = $facultyObj->getVar("fid"); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('faculty_online', 1, '=')); $allfaculty = $faculty_obj_Handler->getall($criteria); $facultyidarray=faculty2array($allfaculty); $titleIndex = $gradsObj->getVar("title"); $gradsTitle=$topic_tree->getByKey($titleIndex)->getVar('topic_title'); $grads['titlename']=$gradsTitle; $grads['supervisor']=faculty2names($grads['supervisor'], $facultyidarray); $grads['yearin']=date("Y", $grads['grads_date_created']); $xoopsTpl->assign('faculty', $grads); $xoopsTpl->assign('xoops_pagetitle', $grads['titlename'].' '.$grads['fname'].' '.$grads['lname']); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('section_ta_online', 1, '=')); $criteria->add(new Criteria('gid', $gid, '=')); $sectiontaObjs = $section_taHandler->getAll($criteria); $criteria = new CriteriaCompo(); //$criteria->add(new Criteria('topic_online', 1, '=')); $allcoursetopic=$coursetopicHandler->getall($criteria); $coursetopic_tree = new XoopsObjectTree($allcoursetopic, 'topic_id', 'topic_pid'); $sectionidarray=array(); foreach ($sectiontaObjs as $sectObj) $sectionidarray[]=$sectObj->getVar('section_id'); $sections=array(); if (count($sectionidarray) > 0){ $sub=SQLinkeyarray($sectionidarray); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('section_online', 1, '=')); $criteria->add(new Criteria('section_id', $sub, 'in')); $sectionObjs = $section_obj_Handler->getObjects($criteria); $have_combined=0; foreach($sectionObjs as $item){ $sectionID = $item->getVar("section_id"); $course_id = $item->getVar("course_id"); $courseObj = $courseHandler->get($course_id); $courseTitle=initletters(id2subject($courseObj->getVar('subject'), $coursetopic_tree)).$courseObj->getVar('course_number'); $termname2= idstring2title($item->getVar('term'), $coursetopic_tree); $termname= id2term($item->getVar('term'), $coursetopic_tree); $coursename=$courseTitle.$termname.$item->getVar('section_title'); $sections[]=array('section_id'=>$sectionID,'course_id'=>$course_id,'section_title'=>$item->getVar('section_title'), 'enrollment'=>$item->getVar('enrollment'),'term'=>$termname2, 'graduate_course'=>$courseObj->getVar('graduate_course'), 'cross_listed'=>$item->getVar('cross_listed'),'course_name'=>$coursename,'coordinator'=>$item->getVar('coordinator'), 'required_room_size'=>$item->getVar('required_room_size'), 'fid'=>$item->getVar('fid') ); if ($item->getVar('cross_listed') != 0) $have_combined++; } $xoopsTpl->assign('have_combined',$have_combined); $mainpage=$coursetopic_tree -> getFirstChild(7); foreach($mainpage as $node){ if ('Section' == $node -> getVar("topic_title") ) { $cid= $node -> getVar('topic_id'); break; } } $criteria = new CriteriaCompo(); $criteria->add(new Criteria('cid', $cid, '=')); $criteria->setSort('weight'); $extra_fields = $mainpageHandler->getObjects($criteria); //$titles = array(_AM_COURSE_SECTION_TITLE); $sel_courses=array(); $sel_items=array(); foreach($sections as $node){ if ($node['cross_listed'] != 0) $sel_items[]="".$node['course_name']."*"; else $sel_items[]="".$node['course_name'].""; foreach ($extra_fields as $field){ $item=$field->getVar('item'); if ($item == 'outline') $sel_items[]=" \""."GO"."\""; elseif ($item == 'cross_listed'||$item == 'coordinator') $sel_items[] = ($node[$item]== 1 ) ? "Yes" : "No"; elseif ($item == 'fid') $sel_items[] = faculty2names($node['fid'],$facultyidarray); else $sel_items[] = $node[$item]; } $sel_courses[]= array( 'course_name'=>$node['course_name'], 'sel_items'=>$sel_items, 'section_title'=>$node['section_title']); $sel_items=array(); } if (count($sel_courses)>1){ function cmp($a, $b){ if ($a['course_name'] == $b['course_name']) return 0; return $a['course_name'] < $b['course_name'] ? -1 : 1; } usort($sel_courses, "cmp"); } if (count($sel_courses)){ $xoopsTpl->assign('courses',$sel_courses); $titles=array("Course"); foreach ($extra_fields as $field){ //if ($field->getVar('title')!='fid') $titles[].=$field->getVar('title'); } $xoopsTpl->assign('titles',$titles); } } include_once XOOPS_ROOT_PATH."/footer.php"; ?>