本文整理汇总了PHP中company类的典型用法代码示例。如果您正苦于以下问题:PHP company类的具体用法?PHP company怎么用?PHP company使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了company类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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 {
示例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'));
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
}
}
}
示例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();
}
示例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'));
}
示例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');
}
示例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>