本文整理汇总了PHP中Company类的典型用法代码示例。如果您正苦于以下问题:PHP Company类的具体用法?PHP Company怎么用?PHP Company使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Company类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadCompany
function loadCompany($jsonObject)
{
$id = $jsonObject->id;
// name
$request = "SELECT * FROM company WHERE id = {$id}";
$result = mysql_query($request);
$row = mysql_fetch_object($result);
$name = $row->name;
// departments
$departments = array();
$request = "SELECT * FROM department WHERE cid = {$id} AND did IS NULL";
$result = mysql_query($request);
$count = mysql_num_rows($result);
while ($row = mysql_fetch_object($result)) {
$departments[] = $row->name;
}
// total
$request = "SELECT * FROM employee";
$result = mysql_query($request);
$total = 0;
while ($row = mysql_fetch_object($result)) {
$total += $row->salary;
}
// create company object
$company = new Company();
$company->setDepartments($departments);
$company->setName($name);
$company->setTotal($total);
// return company object
return $company;
}
示例2: addRelatedCompany
public function addRelatedCompany(Company $rCompany)
{
if ($this->data['partIVA'] != '' && $this->data['partIVA'] != 0 && $rCompany->getRawData('partIVA') != '' && $rCompany->getRawData('partIVA') !== 0) {
$this->db->query('INSERT IGNORE INTO `company_to_company` (`or_partIVA`,`dest_partIVA`,`titolo`)
VALUES("' . addslashes($this->data['partIVA']) . '","' . addslashes($rCompany->getRawData('partIVA')) . '","' . addslashes($rCompany->getRawData('titolo')) . '")', \Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE);
}
}
示例3: work
public function work()
{
$job = new Job();
$job->getByUid($this->user->id);
if ($job->hasWorked()) {
throw new Exception('you have already worked');
}
$company = new Company();
$company->get($job->company);
//check if is in the same region
if ($this->user->region != $company->region) {
throw new Exception("You are not in the same region as company");
}
//check if company has funds enough
if ($company->money < $job->salary) {
throw new Exception("The company doesn't have funds enough");
}
$worked = $job->work();
//add extra data before return
if ($worked) {
$data = $this->parse($job);
$data = array_merge($data, $worked);
return $data;
} else {
return false;
}
}
示例4: updateCompany
public function updateCompany(Company $company)
{
$result = $this->companyDao->get($company->getId());
ResultHelper::whenEmpty($result, AppLabelUtil::$ERROR_COMPANY_NOT_FOUND, HttpStatusCode::badRequest());
$company->setStatus($this->validateStatus($company->getStatus()));
$this->companyDao->update($company);
}
示例5: buildForm
/**
* Form builder
*
* @param FormBuilderInterface $builder
* @param array $options
*
* @return null
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->company = $options['company'];
if (null == $this->company) {
$builder->add('company', EntityType::class, array('label' => 'Docgroupcomptable.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) {
return $br->createQueryBuilder('c')->orderBy('c.corporateName', 'ASC');
}, 'choice_label' => 'corporateName', 'multiple' => false, 'by_reference' => true, 'required' => true));
$builder->add('parent', EntityType::class, array('label' => 'Docgroupcomptable.parent.label', 'class' => 'AcfDataBundle:Docgroupcomptable', 'query_builder' => function (DocgroupcomptableRepository $dgr) {
return $dgr->createQueryBuilder('d')->orderBy('d.pageUrlFull', 'ASC');
}, 'choice_label' => 'pageUrlFull', 'multiple' => false, 'by_reference' => true, 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
$builder->add('clone', EntityType::class, array('label' => 'Docgroup.clone.label', 'class' => 'AcfDataBundle:Docgroupcomptable', 'query_builder' => function (DocgroupcomptableRepository $dgr) {
return $dgr->createQueryBuilder('d')->orderBy('d.pageUrlFull', 'ASC');
}, 'choice_label' => 'pageUrlFull', 'multiple' => false, 'by_reference' => true, 'required' => false, 'placeholder' => 'Options.choose', 'mapped' => false));
} else {
$companyId = $this->company->getId();
$builder->add('company', EntityidType::class, array('label' => 'Docgroupcomptable.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) use($companyId) {
return $br->createQueryBuilder('c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('c.corporateName', 'ASC');
}, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
$builder->add('parent', EntityType::class, array('label' => 'Docgroupcomptable.parent.label', 'class' => 'AcfDataBundle:Docgroupcomptable', 'query_builder' => function (DocgroupcomptableRepository $dgr) use($companyId) {
return $dgr->createQueryBuilder('d')->join('d.company', 'c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('d.pageUrlFull', 'ASC');
}, 'choice_label' => 'pageUrlFull', 'multiple' => false, 'by_reference' => true, 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
$builder->add('clone', EntityType::class, array('label' => 'Docgroup.clone.label', 'class' => 'AcfDataBundle:Docgroupcomptable', 'query_builder' => function (DocgroupcomptableRepository $dgr) use($companyId) {
return $dgr->createQueryBuilder('d')->join('d.company', 'c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('d.pageUrlFull', 'ASC');
}, 'choice_label' => 'pageUrlFull', 'multiple' => false, 'by_reference' => true, 'required' => false, 'placeholder' => 'Options.choose', 'mapped' => false));
}
$builder->add('label', TextType::class, array('label' => 'Docgroupcomptable.label.label'));
$builder->add('otherInfos', TextareaType::class, array('label' => 'Docgroupcomptable.otherInfos.label', 'required' => false));
}
示例6: buildForm
/**
* Form builder
*
* @param FormBuilderInterface $builder
* @param array $options
*
* @return null
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->company = $options['company'];
if (null == $this->company) {
$builder->add('company', EntityType::class, array('label' => 'Address.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) {
return $br->createQueryBuilder('c')->orderBy('c.corporateName', 'ASC');
}, 'choice_label' => 'corporateName', 'multiple' => false, 'by_reference' => true, 'required' => true));
} else {
$companyId = $this->company->getId();
$builder->add('company', EntityidType::class, array('label' => 'Address.company.label', 'class' => 'AcfDataBundle:Company', 'query_builder' => function (CompanyRepository $br) use($companyId) {
return $br->createQueryBuilder('c')->where('c.id = :id')->setParameter('id', $companyId)->orderBy('c.corporateName', 'ASC');
}, 'choice_label' => 'id', 'multiple' => false, 'by_reference' => true, 'required' => true));
}
$builder->add('label', TextType::class, array('label' => 'Address.label.label'));
$builder->add('streetNum', IntegerType::class, array('label' => 'Address.streetNum.label', 'scale' => 0, 'required' => false));
$builder->add('address', TextareaType::class, array('label' => 'Address.address.label', 'required' => false));
$builder->add('address2', TextareaType::class, array('label' => 'Address.address2.label', 'required' => false));
$builder->add('town', TextType::class, array('label' => 'Address.town.label', 'required' => false));
$builder->add('zipCode', TextType::class, array('label' => 'Address.zipCode.label', 'required' => false));
$builder->add('country', CountryType::class, array('label' => 'Address.country.label', 'required' => false, 'placeholder' => 'Options.choose', 'empty_data' => null));
$builder->add('email', EmailType::class, array('label' => 'Address.email.label', 'required' => false));
$builder->add('phone', TextType::class, array('label' => 'Address.phone.label', 'required' => false));
$builder->add('mobile', TextType::class, array('label' => 'Address.mobile.label', 'required' => false));
$builder->add('fax', TextType::class, array('label' => 'Address.fax.label', 'required' => false));
$builder->add('otherInfos', TextareaType::class, array('label' => 'Address.otherInfos.label', 'required' => false));
}
示例7: 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;
}
示例8: _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);
}
示例9: actionAddcompany
public function actionAddcompany()
{
$companyModel = new Company();
$userLoginModel = new UserLogin();
$userProfileModel = new UserProfile();
if (isset($_POST['Company'])) {
$companyModel->attributes = $_POST['Company'];
$userLoginModel->attributes = $_POST['UserLogin'];
$userProfileModel->attributes = $_POST['UserProfile'];
if ($companyModel->validate()) {
if ($companyModel->save()) {
$userLoginModel->UserRoleID = 2;
// $userLoginModel->LoginEmail = 'addeduser@test.com';
$userLoginModel->UserPassword = md5($userLoginModel->UserPassword);
$userLoginModel->IsPasswordReset = 1;
$userLoginModel->IsActive = 1;
$userLoginModel->save();
$userProfileModel->UserLoginID = $userLoginModel->UserLoginID;
$userProfileModel->CompanyID = $companyModel->CompanyID;
// $userProfileModel->FirstName = 'Test';
// $userProfileModel->LastName = 'test';
$userProfileModel->AgreeToTerms = 0;
$userProfileModel->IsFacilitator = 0;
$userProfileModel->save();
$this->redirect(Yii::app()->createUrl('admin/setup', array('id' => $companyModel->CompanyID)));
}
}
}
$this->render('add-company', array('companyModel' => $companyModel, 'userLoginModel' => $userLoginModel, 'userProfileModel' => $userProfileModel));
}
示例10: createAndSaveMultipleCompanies
public function createAndSaveMultipleCompanies($count)
{
for ($i = 65; $i <= 65 + $count - 1; $i++) {
$company = new Company();
$company->setName(sprintf($this->getCreatedCompanynamePattern(), chr($i)));
$company->save();
}
}
示例11: getCompany
function getCompany($companyID)
{
$company = new Company();
if ($company->selectRecord($companyID)) {
return $company;
} else {
return false;
}
}
示例12: encoder_redirect_success
function encoder_redirect_success(Company $company)
{
$Company_Name = $company->getCompanyName();
$Company_Name_Amharic = $company->getCompanyNameAmharic();
$dir = "VIEW/html/Encoder/Add_Company/Company_List.php?success=1&Company_Name={$Company_Name}&Company_Name_Amharic={$Company_Name_Amharic}";
$url = BASE_URL . $dir;
header("Location:{$url}");
//redirect the encoder to the regions add place
exit;
}
示例13: updateCompany
function updateCompany($xmlStr)
{
if (!($domDoc = domxml_open_mem($xmlStr))) {
return false;
}
$company = new Company();
$company->parseDomDocument($domDoc);
$ret = $company->updateRecord();
return $ret;
}
示例14: display
function display()
{
Load::model('company');
$Company = new Company();
$param['income'] = $Company->get_income();
$param['expense'] = $Company->get_expense();
//$param['onhand'] = $this->get_cashonhand();
//$param['aff_money'] = $this->get_affmoney();
Load::view('business-status', $param);
}
示例15: getCompanyDetails
function getCompanyDetails($companyID)
{
$company = new Company();
$company->selectRecord($companyID);
if (!($domDoc = $company->getDomDocument())) {
return false;
} else {
$xmlStr = $domDoc->dump_mem(true);
return $xmlStr;
}
}