當前位置: 首頁>>代碼示例>>PHP>>正文


PHP company::by_userid方法代碼示例

本文整理匯總了PHP中company::by_userid方法的典型用法代碼示例。如果您正苦於以下問題:PHP company::by_userid方法的具體用法?PHP company::by_userid怎麽用?PHP company::by_userid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在company的用法示例。


在下文中一共展示了company::by_userid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_content

 public function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT, $SESSION;
     // Only display if you have the correct capability.
     if (!iomad::has_capability('block/iomad_company_admin:company_add', context_system::instance())) {
         return;
     }
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     if (!isloggedin()) {
         $this->content->text = get_string('pleaselogin', 'block_iomad_company_selector');
         return $this->content;
     }
     //  Check users session and profile settings to get the current editing company.
     if (!empty($SESSION->currenteditingcompany)) {
         $selectedcompany = $SESSION->currenteditingcompany;
     } else {
         if (!empty($USER->profile->company)) {
             $usercompany = company::by_userid($USER->id);
             $selectedcompany = $usercompany->id;
         } else {
             $selectedcompany = "";
         }
     }
     // Get the company name if set.
     if (!empty($selectedcompany)) {
         $companyname = company::get_companyname_byid($selectedcompany);
     } else {
         $companyname = "";
     }
     // Get a list of companies.
     $companylist = company::get_companies_select();
     $select = new single_select(new moodle_url('/local/iomad_dashboard/index.php'), 'company', $companylist, $selectedcompany);
     $select->label = get_string('selectacompany', 'block_iomad_company_selector');
     $select->formid = 'choosecompany';
     $fwselectoutput = html_writer::tag('div', $OUTPUT->render($select), array('id' => 'iomad_company_selector'));
     $this->content->text = $OUTPUT->container_start('companyselect');
     if (!empty($SESSION->currenteditingcompany)) {
         $this->content->text .= '<h3>' . get_string('currentcompany', 'block_iomad_company_selector') . ' - ' . $companyname . '</h3>';
     } else {
         $this->content->text .= '<h3>' . get_string('nocurrentcompany', 'block_iomad_company_selector') . '</h3>';
     }
     $this->content->text .= $fwselectoutput;
     $this->content->text .= $OUTPUT->container_end();
     return $this->content;
 }
開發者ID:sumitnegi933,項目名稱:Moodle_lms_New,代碼行數:53,代碼來源:block_iomad_company_selector.php

示例2: load_company

 /**
  * Set up a users company in their profile.
  *
  * */
 public static function load_company()
 {
     global $USER;
     if (!isset($USER->company->id)) {
         if (self::is_company_user()) {
             $company = company::by_userid($USER->id);
             $fields = 'id, shortname, name';
             $cssfields = implode(',', $company->cssfields);
             if ($cssfields) {
                 $fields .= ', ' . $cssfields;
             }
             $USER->company = $company->get($fields);
             $USER->company->logo_filename = $company->get_logo_filename();
         }
     }
 }
開發者ID:sumitnegi933,項目名稱:Moodle_lms_New,代碼行數:20,代碼來源:iomad.php

示例3: iomadhead

 public function iomadhead()
 {
     global $SESSION, $SITE, $USER;
     if (!empty($SESSION->currenteditingcompany)) {
         $selectedcompany = $SESSION->currenteditingcompany;
     } else {
         if (!empty($USER->profile->company)) {
             $usercompany = company::by_userid($USER->id);
             $selectedcompany = $usercompany->id;
         } else {
             $selectedcompany = "";
         }
     }
     // Get the company name if set.
     if (!empty($selectedcompany)) {
         $companyname = company::get_companyname_byid($selectedcompany);
     } else {
         $companyname = $SITE->shortname;
     }
     return $companyname;
 }
開發者ID:sumitnegi933,項目名稱:Moodle_lms_New,代碼行數:21,代碼來源:core_renderer.php


注:本文中的company::by_userid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。