Esempio n. 1
0
                 if ($category->c_id == $courseId) {
                     echo 1;
                     exit;
                 }
             }
         } else {
             echo 0;
             exit;
         }
     }
     break;
 case 'search_category_parent':
     $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'simple';
     $filterByGlobal = isset($_REQUEST['filter_by_global']) ? $_REQUEST['filter_by_global'] : null;
     $cat = new Testcategory(null, null, null, null, $type);
     $items = $cat->get_categories_by_keyword($_REQUEST['tag']);
     $courseId = api_get_course_int_id();
     $em = Database::getManager();
     $repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory');
     $json_items = array();
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($item['c_id'] == 0) {
                 if ($filterByGlobal) {
                     $cat = $em->find('ChamiloCoreBundle:CQuizCategory', $item['iid']);
                     $idList = array();
                     if ($cat) {
                         $path = $repo->getPath($cat);
                         if (!empty($path)) {
                             /** @var \Chamilo\Entity\CQuizCategory $cat */
                             foreach ($path as $cat) {