Beispiel #1
0
 public function schoolTreeMenu($states, $user)
 {
     $output = "";
     $School = new Table_Schools();
     $Pop = new Table_Popularity();
     $tUser = new Table_UsersInfo();
     $class_year = $tUser->getUser($user->user_id)->class_year;
     //print_r($class_year);die;
     foreach ($states as $key => $state) {
         if ($schoollist = $School->getSchoolByState($key)) {
             $count = count($schoollist);
             $output .= "<li class='expandable'><div class='hitarea expandable-hitarea'></div>" . $state;
             $output .= "<ul  class='ulhide' style='display:none;'>";
             foreach ($schoollist as $num => $s) {
                 $popnum = $Pop->getPopularity(1, $s["school_id"], $class_year, $user->school_id);
                 if (strlen($s["name"]) > 30) {
                     $name = substr($s["name"], 0, 30) . "...";
                 } else {
                     $name = $s["name"];
                 }
                 $output .= "<li";
                 if ($count == $num + 1) {
                     $output .= " class='last' ";
                 }
                 $output .= ">\n   \t\t\t\t\t\t\t<span class='popularity'   name='" . $s["school_id"] . "'>" . $name . "(" . $popnum . ")</span>\n   \t\t  \n   \t\t\t\t\t\t\t</li>";
             }
             $output .= "\t</ul></li>";
         } else {
             $output .= "<li>" . $state . "</li>";
         }
     }
     $this->view->output = $output;
     $this->view->setScriptPath(APPLICATION_PATH . '/layouts/helpers/school-menu/');
     $sHTML = $this->view->render('school-tree-menu.phtml');
     return $sHTML;
 }
Beispiel #2
0
 public function addnumAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $arResult = array('error' => '');
     $class = 3;
     if ($school_id = $this->getRequest()->getParam('school_id', '')) {
         if ($school_id == '') {
             return false;
         } else {
             $tPop = new Table_Popularity();
             $tPop->createPopularity(1, $school_id, $class, $this->user->school_id);
             $arResult['url'] = "chat?sid=" . $school_id;
         }
     } else {
         $arResult['error'] = "Please enter comment";
     }
     $this->_helper->json($arResult, true, false);
 }
Beispiel #3
0
 public static function getPopularity($objecttype, $object_id, $class, $myschool)
 {
     $tPopularity = new Table_Popularity();
     $Popularity = $tPopularity->getPopularity($objecttype, $object_id, $class, $myschool);
     return $Popularity;
 }