本文整理汇总了PHP中Company::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::load方法的具体用法?PHP Company::load怎么用?PHP Company::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::load方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCompanyEmail
static function getCompanyEmail($company_id)
{
// Get the email address for the company
// Use the first Technical address that is not defined as name TICKET_SUPPORT
// TICKET_SUPPORT is defined in conf/config.php
// If that does not exist, use the main address
$config = Config::Instance();
$contact = '';
$company = new Company();
$company->load($company_id);
$party = $company->party;
$sh = new SearchHandler(new PartyContactMethodCollection(new PartyContactMethod()), false);
$sh->AddConstraint(new Constraint('type', '=', 'E'));
$ticket_support = $config->get('TICKET_SUPPORT');
if (!empty($ticket_support)) {
$sh->AddConstraint(new Constraint('name', '!=', $ticket_support));
}
$party->addSearchHandler('contactmethods', $sh);
$methods = $party->contactmethods;
foreach ($methods as $method) {
if ($method->technical == true) {
// Technical contact favoured above all else
$contact = $method->contact;
break;
}
if ($method->main == true) {
// If no contact yet found and this contact is the main contact, use this instead
$contact = $method->contact;
}
}
return $contact;
}
示例2: _new
public function _new()
{
parent::_new();
$this->setTemplateName('calls_new');
$projects = $opportunities = $activities = null;
if (isset($this->_data['person_id'])) {
$person = new Person();
$person->load($this->_data['person_id']);
$this->_data['company_id'] = $person->company_id;
$projects = $person->projects;
$opportunities = $person->opportunities;
$activities = $person->activities;
$this->view->set('person', $person->fullname);
}
if (isset($this->_data['company_id'])) {
$company = new Company();
$company->load($this->_data['company_id']);
$projects = DataObjectCollection::Merge($company->projects, $projects);
$opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities);
$activities = DataObjectCollection::Merge($company->activities, $activities);
$this->view->set('company', $company->name);
}
if (isset($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$this->_data['company_id'] = $project->company_id;
}
$this->view->set('projects', $projects);
$this->view->set('opportunities', $opportunities);
$this->view->set('activities', $activities);
}
示例3: _new
public function _new()
{
parent::_new();
$ticket = $this->_uses[$this->modeltype];
if (isset($this->_data['originator_company_id'])) {
$company = new Company();
$company->load($this->_data['originator_company_id']);
$this->view->set('originator_company', $company->name);
$this->view->set('people', $company->getPeople());
$this->view->set('email', Ticket::getCompanyEmail($this->_data['originator_company_id']));
} else {
$company = new Systemcompany();
$company->load(EGS_COMPANY_ID);
$this->view->set('originator_company', $company->company);
$this->view->set('people', $company->systemcompany->getPeople());
}
$ticketreleaseversion = new TicketReleaseVersion();
$releaseversion_cc = new ConstraintChain();
$releaseversion_cc->add(new Constraint('status', '<>', $ticketreleaseversion->releasedStatus()));
if (!$ticket->isLoaded()) {
$defaults = new TicketConfiguration();
if (isset($this->_data['originator_company_id'])) {
$cc = new ConstraintChain();
$cc->add(new Constraint('company_id', '=', $this->_data['originator_company_id']));
$defaults->loadBy($cc);
}
if (!$defaults->isLoaded()) {
$cc = new ConstraintChain();
$cc->add(new Constraint('company_id', '=', EGS_COMPANY_ID));
$defaults->loadBy($cc);
}
if ($defaults->isLoaded()) {
$this->view->set('client_ticket_status_default', $defaults->client_ticket_status_id);
$this->view->set('internal_ticket_status_default', $defaults->internal_ticket_status_id);
$this->view->set('ticket_queue_default', $defaults->ticket_queue_id);
$this->view->set('ticket_category_default', $defaults->ticket_category_id);
$this->view->set('client_ticket_severity_default', $defaults->client_ticket_severity_id);
$this->view->set('internal_ticket_severity_default', $defaults->internal_ticket_severity_id);
$this->view->set('client_ticket_priority_default', $defaults->client_ticket_priority_id);
$this->view->set('internal_ticket_priority_default', $defaults->internal_ticket_priority_id);
}
}
if (!empty($this->_data['ticket_release_version_id'])) {
$ticket->ticket_release_version_id = $this->_data['ticket_release_version_id'];
}
if (!is_null($ticket->ticket_release_version_id)) {
$releaseversion_cc->add(new Constraint('id', '=', $ticket->ticket_release_version_id), 'OR');
}
$ticket->belongsTo['release_version']['cc'] = $releaseversion_cc;
}
示例4: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$systemcompany = $this->_uses[$this->modeltype];
$this->addSidebar($systemcompany);
$company = new Company();
$company->load($systemcompany->company_id, TRUE);
$this->view->set('company', $company);
$permissions = new CompanypermissionCollection(new Companypermission());
$permissions->getPermissions($systemcompany->id);
$this->view->set('permissions', $permissions);
$this->view->set('page_title', $this->getPageName('system_company'));
}
示例5: array
{
var $belongs_to = array('product');
var $has_multiple = array('material' => 4);
var $fields = array('price' => array(DT_AMOUNT, true));
}
/** 1.0. Clear out the database */
DB::execute("TRUNCATE combination");
DB::execute("TRUNCATE material");
DB::execute("TRUNCATE product");
DB::execute("TRUNCATE company");
/** 1.1. Create a new company */
$company = new Company();
$company->name = 'Testowa S.A.';
$company->save();
/** 1.2. Check if successfully created */
debug($company->load());
/** 1.3. Add a new product */
$product = new Product();
$product->belongs_to($company);
$product->name = 'Kanapa trzydrzwiowa';
$product->save();
/** 1.4. Check if successfully created */
debug($product->load());
/** 1.5. Create two new materials */
$mat_1 = new Material();
$mat_1->belongs_to($company);
$mat_1->name = 'Skóra';
$mat_1->save();
$mat_2 = new Material();
$mat_2->belongs_to($company);
$mat_2->name = 'Drewno brzozowe';
示例6: LoginException
throw new LoginException("You do not have permission to use this feature. Please log into the Administrator account.");
}
list($company->name, $company->address, $company->city, $company->state, $company->zip, $company->phone, $company->logo) = $input->getInputValues('name', 'address', 'city', 'state', 'zip', 'phone', 'logo');
$id = $company->exists();
if ($id) {
$company->id = $id;
}
if ($company->name) {
$company->validate();
if ($company->save()) {
flash("Company Information Updated");
} else {
throw new Exception("Could Not Save To Database.");
}
} else {
if ($id) {
$company->load($id);
}
}
include "../views/companyinfo.php";
} catch (LoginException $e) {
$redirect = "companyinfo.php";
include "../views/login.php";
throw $e;
} catch (InputException $e) {
include "../views/companyinfo.php";
throw $e;
} catch (Exception $e) {
include "../views/companyinfo.php";
throw $e;
}
示例7: request
function request($params)
{
$errors = array();
// Parse parameters.
$p1 = $params->getParam(0);
$subject = $p1->scalarval();
$p2 = $params->getParam(1);
$from_email = $p2->scalarval();
$p3 = $params->getParam(2);
$parts = array();
foreach ($p3->scalarval() as $body) {
$parts[] = $body->scalarval();
}
$content = $parts[0]['content'];
$request = $content->scalarval();
unset($parts[0]);
$p4 = $params->getParam(3);
$to_email = $p4->scalarval();
/*
- mandatory fields
summary character varying NOT NULL,
client_ticket_priority_id bigint NOT NULL,
client_ticket_severity_id bigint NOT NULL,
ticket_queue_id bigint NOT NULL,
ticket_category_id bigint NOT NULL,
internal_ticket_priority_id bigint NOT NULL,
internal_ticket_severity_id bigint NOT NULL,
internal_ticket_status_id bigint NOT NULL,
client_ticket_status_id bigint NOT NULL,
- optional fields
originator_person_id character varying,
originator_company_id bigint,
company_sla_id bigint,
action_code character varying(4),
originator_email_address character varying,
assigned_to character varying,
*/
$config = Config::Instance();
$companyid = '';
$contact = new PartyContactMethodCollection(new PartyContactMethod());
$sh = new SearchHandler($contact, false, false);
$sh->addConstraint(new Constraint('name', '=', $config->get('TICKET_SUPPORT')));
$sh->addConstraint(new Constraint('type', '=', 'E'));
$sh->addConstraint(new Constraint('technical', 'is', TRUE));
$sh->addConstraint(new Constraint('contact', '=', $to_email));
$contact->load($sh);
if ($contact->count() > 0) {
$party_ids = array();
foreach ($contact as $party) {
$party_ids[] = $party->party_id;
$usercompanyid = $party->usercompanyid;
}
if (!defined('EGS_COMPANY_ID')) {
define('EGS_COMPANY_ID', $usercompanyid);
}
$company = new Company();
$cc = new ConstraintChain();
$cc->add(new Constraint('party_id', 'in', '(' . implode(',', $party_ids) . ')'));
$companylist = $company->getAll($cc);
if (count($companylist) != 1) {
$errors[] = '1) Unable to find your support details - please contact technical support';
} else {
$company->load(key($companylist), true);
$companyid = $company->id;
$usercompanyid = $company->usercompanyid;
}
} else {
$errors[] = '2) Unable to find your support details - please contact technical support';
}
$data['attachments'] = $parts;
$data['TicketResponse']['body'] = $request;
$data['TicketResponse']['type'] = 'site';
$data['Ticket']['originator_company_id'] = $companyid;
$data['reply_address'] = $to_email;
$start = strpos($subject, '[');
$end = strpos($subject, ']');
$mid = strpos($subject, '-');
if ($start > 0 && $mid > 0 && $end > 0 && $start < $end && $start < $mid && $mid < $end) {
$ticket = substr($subject, $mid + 1, $end - $mid - 1);
}
if (empty($request)) {
$errors[] = 'No request details submitted';
} elseif (count($errors) == 0) {
if (isset($ticket) && is_numeric($ticket)) {
$data['TicketResponse']['ticket_id'] = $ticket;
self::updateRequest($data, $errors);
$response = "Your response for Ticket " . $ticket . " has been received. The person dealing with your query has been notified.";
} else {
$data['Ticket']['summary'] = $subject;
$data['Ticket']['originator_email_address'] = $from_email;
$data['Ticket']['usercompanyid'] = $usercompanyid;
self::newRequest($data, $errors);
$response = "Your request has been received and assigned ticket no. " . $data['TicketResponse']['ticket_id'] . ". A confirmation email has been sent.";
}
}
if (count($errors) > 0) {
$errors[] = $sh->constraints->__toString();
$result = "ERROR\n";
$response = "Subject:" . $subject . "\n";
//.........这里部分代码省略.........
示例8: load_Companys
public static function load_Companys($columns = null, $filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null)
{
global $DB;
$result = $DB->make_select('Companys', $columns, $filter, $sortby, $sortdir, $limit, $start);
$dbo_array = array();
while ($data = $DB->row($result)) {
$dbo = new Company();
$dbo->load($data);
$dbo_array[] = $dbo;
}
return $dbo_array;
}