/** * executes courses list mahara * * @param sfWebRequest $request_object * @param returns products details along with courses. * gets values from get method */ public function executeView(sfWebRequest $request) { global $CFG; $CFG->current_app->requireMahara(); $this->params = $request->getGetParameters(); $this->course = false; $this->current_app_short_name = $CFG->current_app->getShortName(); 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; } } } // gets all available schools $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); // gets catalog-wise courses count foreach ($eschool_array as $eschool) { //$catalog_courses_count[$eschool->getShortName()] = $eschool->getFullName(); $catalog_courses_count[$eschool->getShortName()] = $this->getHTMLCoursesCount($eschool->getShortName()); } //print_r($catalog_courses_count); $this->catalog_courses_count = $catalog_courses_count; // gets individual courses - products list $ind_products = GcrProductsTable::getProductIndividuals($this->current_app_short_name); $ind_products_list = array(); $products_list_institution = array(); $ind_products_details = array(); foreach ($ind_products as $product) { $ind_products_list[$product->getShortName()] = $product->getFullName(); $products_list_institution[$product->getShortName()] = $product->getInstitutionShortName(); $ind_products_details[$product->getShortName()]["id"] = $product->getId(); $ind_products_details[$product->getShortName()]["short_name"] = $product->getShortName(); $ind_products_details[$product->getShortName()]["full_name"] = $product->getFullName(); $products_details[$product->getShortName()]["institution_short_name"] = $product->getInstitutionShortName(); $ind_products_details[$product->getShortName()]["description"] = $product->getDescription(); $ind_products_details[$product->getShortName()]["cost"] = $product->getCost(); $ind_products_details[$product->getShortName()]["pricing_html"] = $product->getPricingHtml(); $ind_products_details[$product->getShortName()]["icon"] = $product->getIcon(); $ind_products_details[$product->getShortName()]["institution_short_name"] = $product->getInstitutionShortName(); $ind_products_details[$product->getShortName()]["catalog_short_name"] = $product->getCatalogShortName(); $ind_products_details[$product->getShortName()]["platform_short_name"] = $product->getPlatformShortName(); } //print_r($products_list_institution); $this->ind_products_list = $ind_products_list; $this->products_list_institution = $products_list_institution; $this->ind_products_details = $ind_products_details; $this->getResponse()->setTitle('Courses'); sfConfig::set('sf_escaping_strategy', false); }
public function executeView(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::getProducts(); $products_list = array(); foreach($products as $product) { $products_list[$product->getShortName()] = $product->getFullName(); } $this->libraries_list = $products_list; $this->getResponse()->setTitle('Courses'); sfConfig::set('sf_escaping_strategy', false);*/ 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; $ind_products = GcrProductsTable::getProductIndividuals(); $cert_products = GcrProductsTable::getProductCertifications(); $ind_products_list = array(); $cert_products_list = array(); $ind_products_details = array(); $cert_products_details = array(); foreach ($ind_products as $product) { $ind_products_list[$product->getShortName()] = $product->getFullName(); $ind_products_details[$product->getShortName()]["id"] = $product->getId(); $ind_products_details[$product->getShortName()]["short_name"] = $product->getShortName(); $ind_products_details[$product->getShortName()]["full_name"] = $product->getFullName(); $ind_products_details[$product->getShortName()]["description"] = $product->getDescription(); $ind_products_details[$product->getShortName()]["cost"] = $product->getCost(); $ind_products_details[$product->getShortName()]["pricing_html"] = $product->getPricingHtml(); $ind_products_details[$product->getShortName()]["icon"] = $product->getIcon(); } foreach ($cert_products as $product) { $cert_products_list[$product->getShortName()] = $product->getFullName(); $cert_products_details[$product->getShortName()]["id"] = $product->getId(); $cert_products_details[$product->getShortName()]["short_name"] = $product->getShortName(); $cert_products_details[$product->getShortName()]["full_name"] = $product->getFullName(); $cert_products_details[$product->getShortName()]["description"] = $product->getDescription(); $cert_products_details[$product->getShortName()]["cost"] = $product->getCost(); $cert_products_details[$product->getShortName()]["pricing_html"] = $product->getPricingHtml(); $cert_products_details[$product->getShortName()]["icon"] = $product->getIcon(); } $this->ind_products_list = $ind_products_list; $this->cert_products_list = $cert_products_list; $this->ind_products_details = $ind_products_details; $this->cert_products_details = $cert_products_details; $this->getResponse()->setTitle('Courses'); sfConfig::set('sf_escaping_strategy', false); }