当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::get_id方法代码示例

本文整理汇总了PHP中Category::get_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::get_id方法的具体用法?PHP Category::get_id怎么用?PHP Category::get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Category的用法示例。


在下文中一共展示了Category::get_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 /**
  * Insert this link into the database
  */
 public function add()
 {
     $this->add_linked_data();
     if (isset($this->type) && isset($this->ref_id) && isset($this->user_id) && isset($this->course_code) && isset($this->category) && isset($this->weight) && isset($this->visible)) {
         $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
         $sql = "SELECT count(*) FROM " . $tbl_grade_links . "\n                    WHERE\n                        ref_id=" . $this->get_ref_id() . " AND\n                        category_id =  " . $this->category->get_id() . " AND\n                        course_code = '" . $this->course_code . "' AND\n                        type =  " . $this->type . " ";
         $result = Database::query($sql);
         $row_testing = Database::fetch_array($result);
         if ($row_testing[0] == 0) {
             $params = ['type' => $this->get_type(), 'ref_id' => $this->get_ref_id(), 'user_id' => $this->get_user_id(), 'course_code' => $this->get_course_code(), 'category_id' => $this->get_category_id(), 'weight' => $this->get_weight(), 'visible' => $this->is_visible(), 'created_at' => api_get_utc_datetime(), 'locked' => 0];
             $inserted_id = Database::insert($tbl_grade_links, $params);
             $this->set_id($inserted_id);
             return $inserted_id;
         }
     }
     return false;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:20,代码来源:abstractlink.class.php

示例2: add

 /**
  * Insert this link into the database
  */
 public function add()
 {
     $this->add_linked_data();
     if (isset($this->type) && isset($this->ref_id) && isset($this->user_id) && isset($this->course_code) && isset($this->category) && isset($this->weight) && isset($this->visible)) {
         $em = Database::getManager();
         $row_testing = $em->createQuery('
                 SELECT COUNT(gl) FROM ChamiloCoreBundle:GradebookLink gl
                 WHERE gl.refId = :reference AND gl.categoryId = :category AND
                     gl.course = :course AND gl.type = :type
             ')->setParameters(['reference' => $this->get_ref_id(), 'category' => $this->category->get_id(), 'course' => $this->course_id, 'type' => $this->type])->getSingleScalarResult();
         if ($row_testing == 0) {
             $createdAt = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
             $course = $em->find('ChamiloCoreBundle:Course', $this->course_id);
             $gradebookLink = new \Chamilo\CoreBundle\Entity\GradebookLink();
             $gradebookLink->setType($this->get_type())->setRefId($this->get_ref_id())->setUserId($this->get_user_id())->setCourse($course)->setCategoryId($this->get_category_id())->setWeight($this->get_weight())->setVisible($this->is_visible())->setCreatedAt($createdAt)->setLocked(0);
             $em->persist($gradebookLink);
             $em->flush();
             $inserted_id = $gradebookLink->getId();
             $this->set_id($inserted_id);
             return $inserted_id;
         }
     }
     return false;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:27,代码来源:abstractlink.class.php

示例3: get_delete_category_url

 protected function get_delete_category_url(Category $category)
 {
     return ArticlesUrlBuilder::delete_category($category->get_id());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:ArticlesCategoriesManageController.class.php

示例4: get_category_id

 /**
  * @return int
  */
 public function get_category_id()
 {
     return $this->category->get_id();
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:7,代码来源:evaluation.class.php

示例5: get_category_url

 protected function get_category_url(Category $category)
 {
     return MediaUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:MediaSitemapExtensionPoint.class.php

示例6: display_reduce_header_gradebook

 /**
  * @param Category $catobj
  * @param $is_course_admin
  * @param $is_platform_admin
  * @param $simple_search_form
  * @param bool $show_add_qualification
  * @param bool $show_add_link
  */
 public function display_reduce_header_gradebook($catobj, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true)
 {
     //student
     if (!$is_course_admin) {
         $user = api_get_user_info(api_get_user_id());
         $catcourse = Category::load($catobj->get_id());
         $scoredisplay = ScoreDisplay::instance();
         $scorecourse = $catcourse[0]->calc_score(api_get_user_id());
         $scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable');
         $cattotal = Category::load(0);
         $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
         $scoretotal_display = isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable');
         $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name'] . '</b><br />';
         if (!$catobj->get_id() == '0' && !isset($_GET['studentoverview']) && !isset($_GET['search'])) {
             $scoreinfo .= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
         }
         $scoreinfo .= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
         Display::display_normal_message($scoreinfo, false);
     }
     // show navigation tree and buttons?
     $header = '<div class="actions">';
     if ($is_course_admin) {
         $header .= '<a href="gradebook_flatview.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
         $header .= '<a href="gradebook_scoring_system.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
     } elseif (!isset($_GET['studentoverview'])) {
         $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('view_list.gif', get_lang('FlatView')) . ' ' . get_lang('FlatView') . '</a>';
     } else {
         $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
     }
     $header .= '</div>';
     echo $header;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:40,代码来源:displaygradebook.php

示例7: create_default_course_gradebook

 /**
  * @param null $course_code
  * @param int $gradebook_model_id
  * @return mixed
  */
 public static function create_default_course_gradebook($course_code = null, $gradebook_model_id = 0)
 {
     if (api_is_allowed_to_edit(true, true)) {
         if (!isset($course_code) || empty($course_code)) {
             $course_code = api_get_course_id();
         }
         $session_id = api_get_session_id();
         $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
         $sql = "SELECT * FROM {$t} WHERE course_code = '" . Database::escape_string($course_code) . "' ";
         if (!empty($session_id)) {
             $sql .= " AND session_id = " . (int) $session_id;
         } else {
             $sql .= " AND (session_id IS NULL OR session_id = 0) ";
         }
         $sql .= " ORDER BY id";
         $res = Database::query($sql);
         if (Database::num_rows($res) < 1) {
             //there is no unique category for this course+session combination,
             $cat = new Category();
             if (!empty($session_id)) {
                 $my_session_id = api_get_session_id();
                 $s_name = api_get_session_name($my_session_id);
                 $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
                 $cat->set_session_id($session_id);
             } else {
                 $cat->set_name($course_code);
             }
             $cat->set_course_code($course_code);
             $cat->set_description(null);
             $cat->set_user_id(api_get_user_id());
             $cat->set_parent_id(0);
             $default_weight_setting = api_get_setting('gradebook_default_weight');
             $default_weight = isset($default_weight_setting) && !empty($default_weight_setting) ? $default_weight_setting : 100;
             $cat->set_weight($default_weight);
             $cat->set_grade_model_id($gradebook_model_id);
             $cat->set_certificate_min_score(75);
             $cat->set_visible(0);
             $cat->add();
             $category_id = $cat->get_id();
             unset($cat);
         } else {
             $row = Database::fetch_array($res);
             $category_id = $row['id'];
         }
     }
     return $category_id;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:52,代码来源:GradebookUtils.php

示例8: category_is_excluded

 public function category_is_excluded(Category $category)
 {
     return in_array($category->get_id(), $this->excluded_categories_ids);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:SearchCategoryChildrensOptions.class.php

示例9: get_category_url

 protected function get_category_url(Category $category)
 {
     return NewsletterUrlBuilder::archives($category->get_id(), $category->get_rewrited_name());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:NewsletterSitemapExtensionPoint.class.php

示例10: update_position

 /**
  * @desc Update category and items position.
  * @param Category $category
  * @param int $id_parent
  * @param int $position
  */
 public function update_position(Category $category, $id_parent, $position)
 {
     $id = $category->get_id();
     if ($this->get_categories_cache()->category_exists($id) && $this->get_categories_cache()->category_exists($id_parent) && !($category->get_id_parent() == $id_parent && $category->get_order() == $position)) {
         $options = new SearchCategoryChildrensOptions();
         $childrens = $this->get_childrens($id, $options);
         $childrens[$id] = $category;
         if (!array_key_exists($id_parent, $childrens)) {
             $max_order = $this->db_querier->get_column_value($this->table_name, 'MAX(c_order)', 'WHERE id_parent=:id_parent', array('id_parent' => $id_parent));
             $max_order = NumberHelper::numeric($max_order);
             if ($position <= 0 || $position > $max_order) {
                 $this->db_querier->update($this->table_name, array('id_parent' => $id_parent, 'c_order' => $max_order + 1), 'WHERE id=:id', array('id' => $id));
             } else {
                 $this->db_querier->update($this->table_name, array('id_parent' => $id_parent, 'c_order' => $position), 'WHERE id=:id', array('id' => $id));
             }
             $this->regenerate_cache();
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:25,代码来源:CategoriesManager.class.php

示例11: get_category_items_exists

 private function get_category_items_exists(Category $category)
 {
     return PersistenceContext::get_querier()->row_exists($this->get_categories_manager()->get_categories_items_parameters()->get_table_name_contains_items(), 'WHERE ' . $this->get_categories_manager()->get_categories_items_parameters()->get_field_name_id_category() . '=:id_category', array('id_category' => $category->get_id()));
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:AbstractDeleteCategoryController.class.php

示例12: get_delete_category_url

 protected function get_delete_category_url(Category $category)
 {
     return CalendarUrlBuilder::delete_category($category->get_id());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:CalendarCategoriesManageController.class.php

示例13: get_delete_category_url

 protected function get_delete_category_url(Category $category)
 {
     return NewsletterUrlBuilder::delete_stream($category->get_id());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:NewsletterStreamsManageController.class.php

示例14: create_default_course_gradebook

 /**
  * @param null $course_code
  * @param int $gradebook_model_id
  * @return mixed
  */
 public static function create_default_course_gradebook($course_code = null, $gradebook_model_id = 0)
 {
     if (api_is_allowed_to_edit(true, true)) {
         if (!isset($course_code) || empty($course_code)) {
             $course_code = api_get_course_id();
         }
         $session_id = api_get_session_id();
         $courseId = api_get_course_int_id($course_code);
         $em = Database::getManager();
         $qb = $em->createQueryBuilder();
         $qb->select('gc')->from('ChamiloCoreBundle:GradebookCategory', 'gc');
         $qb->where($qb->expr()->eq('gc.course', $courseId));
         if (!empty($session_id)) {
             $qb->andWhere($qb->expr()->eq('gc.sessionId', $session_id));
         } else {
             $qb->andWhere($qb->expr()->orX($qb->expr()->isNull('gc.sessionId'), $qb->expr()->eq('gc.sessionId', 0)));
         }
         $qb->orderBy('gc.id', 'ASC');
         $res = $qb->getQuery()->getResult();
         if (count($res) < 1) {
             //there is no unique category for this course+session combination,
             $cat = new Category();
             if (!empty($session_id)) {
                 $my_session_id = api_get_session_id();
                 $s_name = api_get_session_name($my_session_id);
                 $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
                 $cat->set_session_id($session_id);
             } else {
                 $cat->set_name($course_code);
             }
             $cat->set_course_code($course_code);
             $cat->set_description(null);
             $cat->set_user_id(api_get_user_id());
             $cat->set_parent_id(0);
             $default_weight_setting = api_get_setting('gradebook.gradebook_default_weight');
             $default_weight = isset($default_weight_setting) && !empty($default_weight_setting) ? $default_weight_setting : 100;
             $cat->set_weight($default_weight);
             $cat->set_grade_model_id($gradebook_model_id);
             $cat->set_certificate_min_score(75);
             $cat->set_visible(0);
             $cat->add();
             $category_id = $cat->get_id();
             unset($cat);
         } else {
             $row = current($res);
             $category_id = $row->getId();
         }
         return $category_id;
     }
     return false;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:56,代码来源:GradebookUtils.php

示例15: get_delete_category_url

 protected function get_delete_category_url(Category $category)
 {
     return DownloadUrlBuilder::delete_category($category->get_id());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:DownloadCategoriesManageController.class.php


注:本文中的Category::get_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。