public function getJs() { global $CFG; foreach ($CFG->current_app->getMnetEschools() as $eschool) { if (GcrEschoolTable::authorizeEschoolAccess($eschool)) { $this->js .= 'category_array["' . $eschool->getShortName() . '"] = [];'; $categories = $eschool->getCourseCategories(false); foreach ($categories as $category) { if ($category->getObject()->visible == 1 || GcrEschoolTable::authorizeHiddenCategoryAccess($eschool)) { $mdl_course_category = $category->getObject(); $this->js .= 'category_array["' . $eschool->getShortName() . '"]["' . $mdl_course_category->id . '"] = "' . $mdl_course_category->name . '";'; } } } } return $this->js; }
public function executeSubscriptions(sfWebRequest $request) { global $CFG; $CFG->current_app->requireMahara(); $this->params = $request->getGetParameters(); $this->course = false; if (isset($this->params['course']) && isset($this->params['catalog'])) { $eschool = GcrEschoolTable::getEschool($this->params['catalog'], true); if ($eschool) { $course = $eschool->getCourse($this->params['course']); if ($course) { $this->course = $course; } } } $eschool_array = array(); $catalog_courses_count = array(); foreach ($CFG->current_app->getMnetEschools() as $eschool) { if (GcrEschoolTable::authorizeEschoolAccess($eschool, true)) { $eschool_array[$eschool->getFullName()] = $eschool; } } ksort($eschool_array); foreach ($eschool_array as $eschool) { //$catalog_courses_count[$eschool->getShortName()] = $eschool->getFullName(); $catalog_courses_count[$eschool->getShortName()] = $this->getHTMLCoursesCount($eschool->getShortName()); } $this->catalog_courses_count = $catalog_courses_count; $products = GcrProductsTable::getProductLibraries(); $products_list = array(); $products_details = array(); foreach ($products as $product) { $products_list[$product->getShortName()] = $product->getFullName(); $products_details[$product->getShortName()]["id"] = $product->getId(); $products_details[$product->getShortName()]["short_name"] = $product->getShortName(); $products_details[$product->getShortName()]["full_name"] = $product->getFullName(); $products_details[$product->getShortName()]["description"] = $product->getDescription(); $products_details[$product->getShortName()]["cost"] = $product->getCost(); $products_details[$product->getShortName()]["pricing_html"] = $product->getPricingHtml(); $products_details[$product->getShortName()]["icon"] = $product->getIcon(); } $this->libraries_list = $products_list; $this->products_details = $products_details; $this->getResponse()->setTitle('Courses'); sfConfig::set('sf_escaping_strategy', false); }
} ?> </h3> </div> <div class="clearfix"></div> <div id="gc_course_catalog_selector" class="gc_course_list_filter"> Catalog:<br/> <select id="gc_course_catalogs"> <option value="1"> All Course Catalogs </option> <?php $eschool_array = []; foreach ($CFG->current_app->getMnetEschools() as $eschool) { if (GcrEschoolTable::authorizeEschoolAccess($eschool, true)) { $eschool_array[$eschool->getFullName()] = $eschool; } } ksort($eschool_array); foreach ($eschool_array as $eschool) { print '<option'; print $params['catalog'] == $eschool->getShortName() ? ' selected="selected"' : ''; print ' value="' . $eschool->getShortName() . '">' . $eschool->getFullName() . '</option>'; } ?> </select> <br /> <select id="gc_course_categories"> <option value="All">All Categories</option> </select>