• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP company类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了company类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: foreach

        $searchparams['firstname'] = '%' . $params['firstname'] . '%';
    }
    if (!empty($params['lastname'])) {
        $sqlsearch .= " AND lastname like :lastname ";
        $searchparams['lastname'] = '%' . $params['lastname'] . '%';
    }
    if (!empty($params['email'])) {
        $sqlsearch .= " AND email like :email ";
        $searchparams['email'] = '%' . $params['email'] . '%';
    }
    $userrecords = $DB->get_fieldset_select('user', 'id', $sqlsearch, $searchparams);
} else {
    if (iomad::has_capability('block/iomad_company_admin:editusers', $systemcontext)) {
        // Check if has role edit company users.
        // Get users company association.
        $departmentusers = company::get_recursive_department_users($departmentid);
        if (count($departmentusers) > 0) {
            $departmentids = "";
            foreach ($departmentusers as $departmentuser) {
                if (!empty($departmentids)) {
                    $departmentids .= "," . $departmentuser->userid;
                } else {
                    $departmentids .= $departmentuser->userid;
                }
            }
            if (!empty($showsuspended)) {
                $sqlsearch = " deleted <> 1 AND id in ({$departmentids}) ";
            } else {
                $sqlsearch = " deleted <> 1 AND suspended = 0 AND id in ({$departmentids}) ";
            }
        } else {
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:editusers.php


示例3: definition_after_data

 /**
  * Form tweaks that depend on current data.
  */
 public function definition_after_data()
 {
     global $USER, $SESSION;
     $mform =& $this->_form;
     $columns =& $this->_customdata;
     foreach ($columns as $column) {
         if ($mform->elementExists($column)) {
             $mform->removeElement($column);
         }
     }
     // Set the companyid to bypass the company select form if possible.
     if (!empty($SESSION->currenteditingcompany)) {
         $companyid = $SESSION->currenteditingcompany;
     } else {
         $companyid = company_user::companyid();
     }
     // Get the department list.
     $parentlevel = company::get_company_parentnode($companyid);
     if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
         $userhierarchylevel = $parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $this->departmentid = $userhierarchylevel;
     $subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
     //  Department drop down.
     $mform->insertElementBefore($mform->createElement('select', 'userdepartment', get_string('department', 'block_iomad_company_admin'), $subhierarchieslist, $userhierarchylevel), 'uutypelabel');
     $this->courseselector = $this->add_course_selector();
     $this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:34,代码来源:uploaduser_form.php


示例4: definition

 public function definition()
 {
     global $CFG, $PAGE, $DB;
     $context = context_system::instance();
     $mform =& $this->_form;
     $strrequired = get_string('required');
     $mform->addElement('hidden', 'templateid', $this->templateid);
     $mform->addElement('hidden', 'templatename', $this->templaterecord->name);
     $mform->addElement('hidden', 'companyid', $this->companyid);
     $mform->setType('templateid', PARAM_INT);
     $mform->setType('companyid', PARAM_INT);
     $mform->setType('templatename', PARAM_CLEAN);
     $company = new company($this->companyid);
     // Then show the fields about where this block appears.
     $mform->addElement('header', 'header', get_string('email_template', 'local_email', array('name' => $this->templaterecord->name, 'companyname' => $company->get_name())));
     $mform->addElement('text', 'subject', get_string('subject', 'local_email'), array('size' => 100));
     $mform->setType('subject', PARAM_NOTAGS);
     $mform->addRule('subject', $strrequired, 'required');
     /* GWL : To replace text area with Rich text editor make textarea code commented 
     		$mform->addElement('textarea', 'body_editor', get_string('body', 'local_email'), 'wrap="virtual" rows="50" cols="100"');
     		 $mform->addHelpButton('body_editor', 'coursesummary');
     		 $mform->setType('body_editor', PARAM_NOTAGS);
     		 $mform->addRule('body_editor', $strrequired, 'required');
              */
     $mform->addElement('editor', 'emailbody_editor', get_string('body', 'local_email'), null, $this->editoroptions);
     $mform->setType('emailbody', PARAM_RAW);
     //end
     $vars = EmailVars::vars();
     $options = "<option value=''>" . get_string('select_email_var', 'local_email') . "</option>";
     foreach ($vars as $i) {
         $options .= "<option value='{{$i}}'>{$i}</option>";
     }
     /*GWL : Code Add for Placeholders $select = "<select class='emailvars' onchange='window.Perficio.onSelectEmailVar(this)'>
       $options</select>";*/
     $select = "<select class='emailvars'>{$options}</select>";
     // End Code
     $html = "<div class='fitem'><div class='fitemtitle'></div><div class='felement'>\n                 {$select}</div></div>";
     $mform->addElement('html', $html);
     global $PAGE;
     //GWL : Add JS
     $PAGE->requires->jquery();
     $PAGE->requires->js('/local/email/module.js');
     $submitlabel = null;
     // Default.
     if ($this->isadding) {
         $submitlabel = get_string('save_to_override_default_template', 'local_email');
         $mform->addElement('hidden', 'createnew', 1);
         $mform->setType('createnew', PARAM_INT);
     }
     $this->add_action_buttons(true, $submitlabel);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:51,代码来源:template_edit_form.php


示例5: add_company_selector

 public function add_company_selector($required = true)
 {
     $mform =& $this->_form;
     if (company_user::is_company_user()) {
         $mform->addElement('hidden', 'companyid', company_user::companyid());
     } else {
         $companies = company::get_companies_rs();
         $companyoptions = array('' => get_string('selectacompany', 'block_iomad_company_admin'));
         foreach ($companies as $company) {
             if (company_user::can_see_company($company->shortname)) {
                 $companyoptions[$company->id] = $company->name;
             }
         }
         $companies->close();
         if (count($companyoptions) == 1) {
             $mform->addElement('html', get_string('nocompanies', 'block_iomad_company_admin'));
             return false;
         } else {
             $mform->addElement('select', 'companyid', get_string('company', 'block_iomad_company_admin'), $companyoptions);
             if ($required) {
                 $mform->addRule('companyid', get_string('missingcompany', 'block_iomad_company_admin'), 'required', null, 'client');
             }
             $defaultvalues['companyid'] = array($this->selectedcompany);
             $mform->setDefaults($defaultvalues);
         }
     }
     return true;
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:28,代码来源:lib.php


示例6: onordercomplete

 function onordercomplete($invoiceitem, $invoice)
 {
     global $DB;
     $transaction = $DB->start_delegated_transaction();
     // Get name for company license.
     $company = company::get_company_byuserid($invoice->userid);
     $course = $DB->get_record('course', array('id' => $invoiceitem->invoiceableitemid), 'id, shortname', MUST_EXIST);
     $licensename = $company->shortname . " [" . $course->shortname . "] " . date("Y-m-d");
     $count = $DB->count_records_sql("SELECT COUNT(*) FROM {companylicense} WHERE name LIKE '" . str_replace("'", "\\'", $licensename) . "%'");
     if ($count) {
         $licensename .= ' (' . ($count + 1) . ')';
     }
     // Create mdl_companylicense record.
     $companylicense = new stdClass();
     $companylicense->name = $licensename;
     $companylicense->allocation = $invoiceitem->license_allocation;
     $companylicense->validlength = $invoiceitem->license_validlength;
     if (!empty($invoiceitem->license_shelflife)) {
         $companylicense->expirydate = $invoiceitem->license_shelflife * 86400 + time();
         // 86400 = 24*60*60 = number of seconds in a day.
     } else {
         $companylicense->expirydate = 0;
     }
     $companylicense->companyid = $company->id;
     $companylicenseid = $DB->insert_record('companylicense', $companylicense);
     // Create mdl_companylicense_courses record for the course.
     $clc = new stdClass();
     $clc->licenseid = $companylicenseid;
     $clc->courseid = $course->id;
     $DB->insert_record('companylicense_courses', $clc);
     // Mark the invoice item as processed.
     $invoiceitem->processed = 1;
     $DB->update_record('invoiceitem', $invoiceitem);
     $transaction->allow_commit();
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:35,代码来源:licenseblock.php


示例7: __construct

 /**
  * Constructor
  *
  * Sets up and retrieves the API objects
  *
  **/
 public function __construct($company, $user, $course, $invoice, $classroom, $license, $sender, $approveuser)
 {
     $this->company =& $company;
     $this->user =& $user;
     $this->invoice =& $invoice;
     $this->classroom =& $classroom;
     $this->license =& $license;
     $this->sender =& $sender;
     $this->approveuser =& $approveuser;
     if (!isset($this->company)) {
         if (isset($user->id) && !isset($user->profile)) {
             profile_load_custom_fields($this->user);
         }
         if (isset($user->profile["company"])) {
             $this->company = company::by_shortname($this->user->profile["company"])->get('*');
         }
     }
     $this->course =& $course;
     if (!empty($course->id)) {
         $this->course->url = new moodle_url('/course/view.php', array('id' => $this->course->id));
     }
     if (!empty($user->id)) {
         $this->url = new moodle_url('/user/profile.php', array('id' => $this->user->id));
     }
     $this->site = get_site();
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:32,代码来源:vars.php


示例8: __construct

 public function __construct($actionurl, $context, $companyid, $departmentid, $licenseid, $courses = array())
 {
     global $USER;
     $this->selectedcompany = $companyid;
     $this->context = $context;
     $this->departmentid = $departmentid;
     $this->licenseid = $licenseid;
     $this->selectedcourses = $courses;
     $company = new company($this->selectedcompany);
     $parentlevel = company::get_company_parentnode($company->id);
     $this->companydepartment = $parentlevel->id;
     if (iomad::has_capability('block/iomad_company_admin:edit_licenses', context_system::instance())) {
         $userhierarchylevel = $parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
     if ($this->departmentid == 0) {
         $departmentid = $userhierarchylevel;
     } else {
         $departmentid = $this->departmentid;
     }
     $options = array('context' => $this->context, 'multiselect' => true, 'companyid' => $this->selectedcompany, 'departmentid' => $departmentid, 'subdepartments' => $this->subhierarchieslist, 'parentdepartmentid' => $parentlevel, 'selected' => $this->selectedcourses, 'license' => true);
     $this->currentcourses = new all_department_course_selector('currentcourselicense', $options);
     parent::moodleform($actionurl);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:27,代码来源:company_license_edit_form.php


示例9: getCompany

 public static function getCompany($company_id)
 {
     global $db;
     $company = null;
     // SQL-spørring for å søke gjennom databasen
     $sql = "SELECT id, navn, description, adresse, postnr, companies.lat, companies.lng, poststedNavn\n\t\t\t\tFROM postnumre, poststed, companies\n\t\t\t\tWHERE (postnumre.poststedID = poststed.poststedID)\n\t\t\t\tAND (companies.postnr = postnumre.postnummer)\n\t\t\t\tAND (id = '" . $company_id . "');";
     $result = $db->query($sql);
     // Lagrer resultater til en array
     while ($row = $result->fetch_object()) {
         $company = new company($row->navn, $row->adresse, $row->postnr, $row->poststedNavn);
         $company->setCompanyId($row->id);
         $company->setDescription($row->description);
     }
     // Returnerer søkeresultatene
     return $company;
 }
开发者ID:KrisHagen,项目名称:gatekjokken,代码行数:16,代码来源:database_handler.php


示例10: __construct

 public function __construct($actionurl, $context, $companyid, $departmentid, $userid, $licenseid)
 {
     global $USER, $DB;
     $this->selectedcompany = $companyid;
     $this->context = $context;
     $company = new company($this->selectedcompany);
     $this->parentlevel = company::get_company_parentnode($company->id);
     $this->companydepartment = $this->parentlevel->id;
     $this->licenseid = $licenseid;
     if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
         $userhierarchylevel = $this->parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
     if ($departmentid == 0) {
         $this->departmentid = $userhierarchylevel;
     } else {
         $this->departmentid = $departmentid;
     }
     $this->userid = $userid;
     $this->user = $DB->get_record('user', array('id' => $this->userid));
     parent::__construct($actionurl);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:25,代码来源:company_users_licenses_form.php


示例11: process

 public function process()
 {
     global $DB;
     if ($this->selectedcompany) {
         $company = new company($this->selectedcompany);
         $companyshortname = $company->get_shortname();
         $companydefaultdepartment = company::get_company_parentnode($company->id);
         // Process incoming assignments.
         if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
             $userstoassign = $this->potentialusers->get_selected_users();
             if (!empty($userstoassign)) {
                 foreach ($userstoassign as $adduser) {
                     $allow = true;
                     if ($allow) {
                         $user = $DB->get_record('user', array('id' => $adduser->id));
                         // Add user to default company department.
                         $company->assign_user_to_company($adduser->id);
                     }
                 }
                 $this->potentialusers->invalidate_selected_users();
                 $this->currentusers->invalidate_selected_users();
             }
         }
         // Process incoming unassignments.
         if (optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) {
             $userstounassign = $this->currentusers->get_selected_users();
             if (!empty($userstounassign)) {
                 foreach ($userstounassign as $removeuser) {
                     // Check if the user was a company manager.
                     if ($DB->get_records('company_users', array('userid' => $removeuser->id, 'managertype' => 1))) {
                         $companymanagerrole = $DB->get_record('role', array('shortname' => 'companymanager'));
                         role_unassign($companymanagerrole->id, $removeuser->id, $this->context->id);
                     }
                     if ($DB->get_records('company_users', array('userid' => $removeuser->id, 'managertype' => 2))) {
                         $departmentmanagerrole = $DB->get_record('role', array('shortname' => 'departmentmanager'));
                         role_unassign($departmentmanagerrole->id, $removeuser->id, $this->context->id);
                     }
                     $DB->delete_records('company_users', array('userid' => $removeuser->id));
                     // Deal with the company theme.
                     $DB->set_field('user', 'theme', '', array('id' => $removeuser->id));
                 }
                 $this->potentialusers->invalidate_selected_users();
                 $this->currentusers->invalidate_selected_users();
             }
         }
     }
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:47,代码来源:company_users_form.php


示例12: total_companies

/**
 * Theme functions for companies
 */
function total_companies()
{
    if (!($companies = Registry::get('companies'))) {
        $companies = company::get();
        $companies = new Items($companies);
        Registry::set('companies', $companies);
    }
    return $companies->length();
}
开发者ID:pepfi,项目名称:anchor-cms,代码行数:12,代码来源:companies.php


示例13: definition

 public function definition()
 {
     global $CFG, $PAGE, $DB;
     $context = context_system::instance();
     $mform =& $this->_form;
     $strrequired = get_string('required');
     $mform->addElement('hidden', 'templateid', $this->templateid);
     $mform->addElement('hidden', 'templatename', $this->templaterecord->name);
     $mform->addElement('hidden', 'companyid', $this->companyid);
     $company = new company($this->companyid);
     // Then show the fields about where this block appears.
     $mform->addElement('header', 'header', get_string('email_template_send', 'local_email', array('name' => $this->templaterecord->name, 'companyname' => $company->get_name())));
     $mform->addElement('static', 'subject', get_string('subject', 'local_email'));
     $mform->addElement('static', 'body', get_string('body', 'local_email'));
     $mform->addElement('header', 'header', get_string('email_data', 'local_email'));
     $this->addHtml($mform, get_string('company', 'block_iomad_company_admin'), $company->get_name());
     $this->addHtml($mform, get_string('select_course', 'local_email'), $this->currentcourses->display(true));
     $this->add_action_buttons(true, get_string('send_emails', 'local_email'));
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:19,代码来源:template_send_form.php


示例14: definition

 public function definition()
 {
     global $CFG, $DB;
     $mform =& $this->_form;
     $company = new company($this->selectedcompany);
     $parentlevel = company::get_company_parentnode($company->id);
     $options = array('context' => context_system::instance(), 'multiselect' => true, 'companyid' => $company->id, 'deptid' => $this->department, 'titleid' => $this->title, 'departmentid' => $parentlevel->id, 'department' => $this->department, 'title' => $this->title, 'exclude' => array(4), 'parentdepartmentid' => $parentlevel, 'licenses' => false, 'shared' => true);
     $this->currentcourses = new current_company_all_course_selector('currentcourses', $options);
     $this->selectedcourses = new department_title_courses('selectedcourses', $options);
     $mform->addElement('hidden', 'department', $this->department);
     $mform->setType('department', PARAM_INT);
     $mform->addElement('hidden', 'title', $this->title);
     $mform->setType('title', PARAM_INT);
     //$courselist = array('Course1', 'Course2', 'Course3', 'Course4');
     // $this->currentcourses->display(true);
     //$select = $mform->addElement('select', 'departmentcourses', get_string('departments', 'local_manage_company_dept_title'), $courselist);
     //$select->setMultiple(true);
     //$select = $mform->addElement('select', 'companycourses', get_string('departments', 'local_manage_company_dept_title'), $courselist);
     //$select->setMultiple(true);
     //$mform->addElement('submit');
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:21,代码来源:company_course_dept_title_form.php


示例15: implode

    $sales = $_POST['sales'] == 'yes' ? $_POST['sales_name'] : '';
    $company_name = $_POST['company_name'];
    $category = implode(",", $_POST['industry']);
    $company_description = $_POST['company_description'];
    $location = $_POST['location'];
    $country = $_POST['country'];
    $registration_no = $_POST['registration_no'];
    $address = $_POST['address'];
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $designation = $_POST['designation'];
    $contact_no = '+' . $_POST['code'] . "-" . $_POST['mobile'];
    $type = 2;
    $status = 0;
    include_once "../config/company.php";
    $ob = new company();
    $ob->insert_company($company_name, $category, $company_description, $country, $location, $registration_no, $address, $sales, $first_name, $last_name, $designation, $contact_no, $email, $password, $type, $status);
}
?>
		  </div>
		</div>
	</div>	
	<!--footer-->
	<div class="footer">
		<div class="container">
			<div class="footer-left"></div>
			<div class="footer-right">
				<p>© 2015 All rights reserved | Template by <a href="http://w3layouts.com/"> Salaj</a></p>
			</div>
			<div class="clearfix"> </div>
		</div>
开发者ID:salajss,项目名称:eRecruitment,代码行数:31,代码来源:Register_Company.php


示例16: printTR

 public function printTR()
 {
     echo '<tr>';
     $c = new company($this->id_company);
     $company = $c->getName();
     echo '<td>' . $this->name . '</td>';
     echo '<td>' . $company . '</td>';
     echo '<td>' . $this->nationality . '</td>';
     echo '<td>' . $this->mail . '</td>';
     echo '<td>' . $this->phone_number . '</td>';
     echo '<td><a href="../controller/viewCustomer.php?id=' . $this->id . '"><button class=""><span class=\'glyphicon glyphicon-cog\' aria-hidden=\'true\'></span></button></a></td>';
     echo '</tr>';
 }
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:13,代码来源:customer.php


示例17: company

<?php

/**
 * 企业黄页后台管理栏目首页文件
 *
 * @author		Arthur([email protected])
 * @copyright	(c) 2006 by bizeway.com
 * @version		$Id$
 * @package		ArthurXF
 * @subpackage	company
 */
require_once '../config/config.inc.php';
require_once "../class/company.class.php";
require_once '../../useradmin/checklogin.php';
$objWebInit = new company();
//数据库连接参数
$objWebInit->setDBG($arrGPdoDB);
//smarty参数
$objWebInit->arrGSmarty = $arrGSmarty;
//翻页参数
$objWebInit->arrGPage = $arrGPage;
//图片上传参数
$objWebInit->arrGPic = $arrGPic;
$objWebInit->db();
$arrWhere = array();
$arrLink = array();
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'search') {
        // 构造搜索条件和翻页参数
        $arrLink[] = 'action=search';
        if (!empty($_GET['title'])) {
开发者ID:TiMoChao,项目名称:lc_ad_first,代码行数:31,代码来源:index.php


示例18: get_user_course_completion_data

 /**
  * Get user completion info for a course
  *
  * Parameters - $departmentid = int;
  *              $courseid = int;
  *              $page = int;
  *              $perpade = int;
  *
  * Return array();
  * */
 public static function get_user_course_completion_data($searchinfo, $courseid, $page = 0, $perpage = 0, $completiontype = 0)
 {
     global $DB;
     $completiondata = new stdclass();
     // Create a temporary table to hold the userids.
     $temptablename = 'tmp_ccomp_users_' . time();
     $dbman = $DB->get_manager();
     // Define table user to be created.
     $table = new xmldb_table($temptablename);
     $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
     $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
     $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
     $dbman->create_temp_table($table);
     // Populate it.
     $alldepartments = company::get_all_subdepartments($searchinfo->departmentid);
     if (count($alldepartments) > 0) {
         $tempcreatesql = "INSERT INTO {" . $temptablename . "} (userid) SELECT userid from {company_users}\n                              WHERE departmentid IN (" . implode(',', array_keys($alldepartments)) . ")";
     } else {
         $tempcreatesql = "";
     }
     $DB->execute($tempcreatesql);
     // Deal with completion types.
     if (!empty($completiontype)) {
         if ($completiontype == 1) {
             $completionsql = " AND cc.timeenrolled > 0 AND cc.timestarted = 0 ";
         } else {
             if ($completiontype == 2) {
                 $completionsql = " AND cc.timestarted > 0 AND cc.timecompleted IS NULL ";
             } else {
                 if ($completiontype == 3) {
                     $completionsql = " AND cc.timecompleted IS NOT NULL  ";
                 }
             }
         }
     } else {
         $completionsql = "";
     }
     // Get the user details.
     if ($vantagefield = $DB->get_record('user_info_field', array('shortname' => 'VANTAGE'))) {
         $countsql = "SELECT u.id ";
         $selectsql = "SELECT u.id,\n                    u.firstname AS firstname,\n                    u.lastname AS lastname,\n                    u.email AS email,\n                    cc.timeenrolled AS timeenrolled,\n                    cc.timestarted AS timestarted,\n                    cc.timecompleted AS timecompleted,\n                    d.name as department,\n                    gg.finalgrade as result,\n                    uid.data as vantage ";
         $fromsql = " FROM {user} u, {course_completions} cc, {department} d, {company_users} du,\n                         {user_info_data} uid, {" . $temptablename . "} tt\n                         LEFT JOIN {grade_grades} gg ON ( gg.itemid = (\n                           SELECT id FROM {grade_items} WHERE courseid = {$courseid} AND itemtype='course'))\n\n                    WHERE {$searchinfo->sqlsearch}\n                    AND tt.userid = u.id\n                    AND cc.course = {$courseid}\n                    AND u.id = cc.userid\n                    AND du.userid = u.id\n                    AND d.id = du.departmentid\n                    AND gg.userid = u.id\n                    AND uid.userid = u.id\n                    AND uid.fieldid = {$vantagefield->id}\n                    {$completionsql}\n                    {$searchinfo->sqlsort} ";
     } else {
         $countsql = "SELECT u.id ";
         $selectsql = "SELECT u.id,\n                    u.firstname AS firstname,\n                    u.lastname AS lastname,\n                    u.email AS email,\n                    cc.timeenrolled AS timeenrolled,\n                    cc.timestarted AS timestarted,\n                    cc.timecompleted AS timecompleted,\n                    d.name as department,\n                    gg.finalgrade as result ";
         $fromsql = " FROM {user} u, {course_completions} cc, {department} d, {company_users} du, {" . $temptablename . "} tt\n                         LEFT JOIN {grade_grades} gg ON ( gg.itemid = (\n                           SELECT id FROM {grade_items} WHERE courseid = {$courseid} AND itemtype='course'))\n\n                    WHERE {$searchinfo->sqlsearch}\n                    AND tt.userid = u.id\n                    AND cc.course = {$courseid}\n                    AND u.id = cc.userid\n                    AND du.userid = u.id\n                    AND d.id = du.departmentid\n                    AND gg.userid = u.id\n                    {$completionsql}\n                    {$searchinfo->sqlsort} ";
     }
     $searchinfo->searchparams['courseid'] = $courseid;
     $users = $DB->get_records_sql($selectsql . $fromsql, $searchinfo->searchparams, $page * $perpage, $perpage);
     $countusers = $DB->get_records_sql($countsql . $fromsql, $searchinfo->searchparams);
     $numusers = count($countusers);
     $returnobj = new stdclass();
     $returnobj->users = $users;
     $returnobj->totalcount = $numusers;
     return $returnobj;
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:66,代码来源:iomad.php


示例19: customer

<?php

require_once '../model/company.php';
$idCo = $_GET['idCo'];
$idCu = $_GET['idCu'];
$customer = new customer($idCu);
$company = new company($idCo);
$company->setId_contact($idCu);
$company->setToDatabase();
$result = array('idContact' => $idCu, 'contact' => $customer->getName() . ' | ' . $customer->getMail() . ' | ' . $customer->getPhone_number());
echo json_encode($result);
开发者ID:JulienRst,项目名称:Biothys-Manager,代码行数:11,代码来源:setCompanyCustomer.php


示例20: company

<?php 
if (!isset($_SESSION['company_id'])) {
    ?>
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a href="view_company.php">Companies</a></li>
	    <li><a class="active" href="#" >Add</a></li>
	</ul>

<div class="page-heading">
	<h1>Add Company</h1>
</div>

<div class="form-container">
<?php 
    $company = new company();
    $ID = isset($_GET['id']) ? $_GET['id'] : NULL;
    if (isset($_POST['add_company'])) {
        // Update old record
        if (isset($ID)) {
            $results = $company->update_company($_POST, $ID);
        } else {
            // Insert new
            $results = $company->insert_company($_POST);
        }
        if ($results) {
            echo '<div class="alert alert-success" role="alert">';
            echo isset($_GET['id']) ? 'Updated ' : 'Added ';
            echo 'company Sucessfully </div>';
        } else {
            echo '<div class="alert alert-danger" role="alert"> Error </div>';
开发者ID:qundeel,项目名称:Restaurant-app,代码行数:31,代码来源:add_company.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP compiler_directive_tag类代码示例发布时间:2022-05-23
下一篇:
PHP common_session_SessionManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap