本文整理汇总了PHP中Company::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::get方法的具体用法?PHP Company::get怎么用?PHP Company::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//We have to change the All() method! All is not good!
$companies = Company::get(['id', 'fancy_name', 'rut']);
$role = check_admin_auth();
return View::make('companies.index', compact('role', 'companies'));
}
示例2: 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;
}
}
示例3: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>Training</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new HtmlEditorField("Overview", "Overview"));
$fields->push(new CheckboxField("Active", "Active"));
$types = TrainingCourseType::get();
$levels = TrainingCourseLevel::get();
$companies = Company::get();
if ($companies) {
$fields->push(new DropdownField('CompanyID', 'Company', $companies->map("ID", "Name", "Please Select a Company")));
}
if ($types && $levels && $this->owner->ID > 0) {
$config = GridFieldConfig_RecordEditor::create();
$courses = new GridField('Courses', 'Courses', $this->owner->Courses(), $config);
$fields->push($courses);
} else {
$fields->push(new LiteralField("Warning", "** You can not add any Training Course until you create some Training Course Levels and Training Course Types!."));
}
return $fields;
}
示例4: CompanyCount
function CompanyCount()
{
$Count = Company::get()->filter('DisplayOnSite', true)->count();
// Round down to nearest multiple of 5
$Count = round(($Count - 2.5) / 5) * 5;
return $Count;
}
示例5: save
function save($data, $form)
{
$response = new OSLogoProgramResponse();
$form->saveInto($response);
// Combine these two fields so we just store a manually typed name in
// $data[OtherCompany]
if ($data['NonSponsorCompany']) {
$response->OtherCompany = $data['NonSponsorCompany'];
}
$response->write();
// Now set the official company name for the email
$data['CompanyName'] = 'Not Provided';
if ($response->OtherCompany) {
$response->CompanyName = $response->OtherCompany;
} elseif ($response->CompanyID != 0) {
$company = Company::get()->byID($response->CompanyID);
if ($company) {
$response->CompanyName = $company->Name;
}
}
// Email the logo email list
$Subject = "Contact Form for Commercial Logo Inquiries";
$email = EmailFactory::getInstance()->buildEmail($data['Email'], OS_LOGO_PROGRAM_FORM_TO_EMAIL, $Subject);
$email->setTemplate('OSLogoProgramResponseEmail');
$email->populateTemplate($response);
$email->send();
if ($response->Program === 'Powered') {
Controller::curr()->setMessage('success', 'Thanks for your interest in licensing the OpenStack Powered logo. Please review the interoperability standards at <a href="http://www.openstack.org/interop" class="alert-link">openstack.org/interop</a> page and submit test results according to the instructions.');
}
return Controller::curr()->redirect(Controller::curr()->Link("thanks"));
}
示例6: showAll
/**
* Display all resources in storage.
*
* @return Response
*/
public function showAll()
{
$companies = Company::get();
// foreach ($company as $value) {
// echo $value->company_type;
// }
return View::make('front_end/main')->with('companies', $companies);
}
示例7: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
if (!check_admin_auth()) {
return Redirect::action('SessionsController@create');
}
$role = check_admin_auth();
$companies = Company::get(['id', 'fancy_name']);
$providers = Provider::get(['id', 'fancy_name']);
return View::make('registrations.create', compact('role', 'providers', 'companies'));
}
示例8: get
public function get()
{
$id = (int) $_REQUEST['id'];
if ($id == 0) {
throw new Exception('missing data');
}
$companyClass = new Company();
$company = $companyClass->get($id);
return $this->parse($company);
}
示例9: testSave
function testSave()
{
$c = new Company();
$this->assertFalse($c->id, 'should not have an id yet');
$c->set(array('name' => 'save_test'));
$c->save();
$this->assertTrue($c->id, 'should have an id');
$this->assertEqual($c->get('name'), 'save_test', 'name should be save_test');
$c2 = new Company($c->id);
$this->assertEqual($c2->get('name'), 'save_test', ' reloaded item name should also be save_test');
}
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new TextField("MaxInstances", "Max. Instances"));
$companies = Company::get();
if ($companies) {
$fields->push($ddl = new DropdownField('CompanyID', 'Company', $companies->map("ID", "Name")));
$ddl->setEmptyString("Please Select a Company");
}
$market_place_types = MarketPlaceType::get();
if ($market_place_types) {
$fields->push($ddl = new DropdownField('MarketPlaceTypeID', 'MarketPlaceType', $market_place_types->map("ID", "Name")));
$ddl->setEmptyString("Please Select a Market Place Type");
}
return $fields;
}
示例11: getAdminPermissionSet
function getAdminPermissionSet(array &$res)
{
$companyId = $_REQUEST["CompanyId"];
if (isset($companyId) && is_numeric($companyId) && $companyId > 0) {
// user could be ccla admin of only one company and company must have at least one team set
$ccla_group = Group::get()->filter('Code', ICLAMember::CCLAGroupSlug)->first();
if (!$ccla_group) {
return;
}
$query_groups = new SQLQuery();
$query_groups->addSelect("GroupID");
$query_groups->addFrom("Company_Administrators");
$query_groups->addWhere("MemberID = {$this->owner->ID} AND CompanyID <> {$companyId} AND GroupID = {$ccla_group->ID} ");
$groups = $query_groups->execute()->keyedColumn();
$company = Company::get()->byID($companyId);
if (count($groups) === 0 && $company->isICLASigned()) {
array_push($res, 'CCLA_ADMIN');
}
}
}
示例12: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new CheckboxField("ContractSigned", "Contract Signed"));
$contract_start = new DateField("ContractStart", "Contract Start");
$fields->push(new TextField("EchosignID", "Echosign ID"));
$contract_start->setConfig('showcalendar', true);
$fields->push($contract_start);
$contract_end = new DateField("ContractEnd", "Contract End");
$contract_end->setConfig('showcalendar', true);
$fields->push($contract_end);
$companies = Company::get();
if ($companies) {
$fields->push(new DropdownField('CompanyID', 'Company', $companies->map("ID", "Name", "Please Select a Company")));
}
$templates = ContractTemplate::get();
if ($templates) {
$fields->push(new DropdownField('ContractTemplate', 'Template', $templates->map("ID", "Name", "Please Select a Contract Template")));
}
return $fields;
}
示例13: up
function up()
{
echo "Starting Migration Proc ...<BR>";
//check if migration already had ran ...
$migration = Migration::get()->filter('Name', $this->title)->first();
if (!$migration) {
$programs = DB::query('SELECT P.*,C.CompanyID from TrainingProgram P INNER JOIN Contract C on C.ID = P.TrainingContractID;');
$service = new TrainingManager(new SapphireTrainingServiceRepository(), new SapphireMarketPlaceTypeRepository(), new MarketPlaceTypeAddPolicyStub(), null, new CacheServiceStub(), new MarketplaceFactory(), SapphireTransactionManager::getInstance());
$factory = new TrainingFactory();
foreach ($programs as $program) {
$company_id = (int) $program['CompanyID'];
$company = Company::get()->byID($company_id);
$program_id = (int) $program['ID'];
$training = $factory->buildTraining($program['Name'], $program['Description'], true, $company);
$training->CompanyID = $company_id;
$training->write();
//get former courses and associate it with new entity
$courses = TrainingCourse::get()->filter('ProgramID', $program_id);
if ($courses && count($courses) > 0) {
foreach ($courses as $course) {
$course->TrainingServiceID = $training->getIdentifier();
$course->write();
}
}
}
//db alter
DB::query('DROP TABLE Training;');
DB::query('ALTER TABLE `TrainingCourse` DROP COLUMN ProgramID;');
DB::query('DROP TABLE TrainingProgram;');
$new_training_group_slug = ITraining::MarketPlaceGroupSlug;
DB::query("\n\t\t\tUPDATE `Company_Administrators`\n\t\t\tSET GroupID = (SELECT ID FROM `Group` WHERE code='{$new_training_group_slug}' LIMIT 1 )\n\t\t\tWHERE ID IN (\n\t\t\t\tSELECT tmp.id FROM\n\t\t\t\t(\n\t\t\t\t\tSELECT ID FROM `Company_Administrators`\n\t\t\t\t\tWHERE GroupID IN ( SELECT ID FROM `Group` where code='training-admins')\n\t\t\t\t) as tmp\n\t\t\t);\n\t\t\t");
DB::query("\n\t\t\tDELETE Permission\n\t\t\tFROM Permission\n\t\t\tWHERE Code='MANAGE_COMPANY_TRAINING';\n\t\t\t");
$migration = new Migration();
$migration->Name = $this->title;
$migration->Description = $this->description;
$migration->Write();
}
echo "Ending Migration Proc ...<BR>";
}
示例14: doUp
function doUp()
{
global $database;
if (DBSchema::existsTable($database, "JobPage")) {
$res = DB::query("SELECT * FROM JobPage;");
foreach ($res as $record) {
$new_job = new Job();
$new_job->ID = (int) $record['ID'];
$new_job->Title = $record['Title'];
$new_job->Description = $record['Content'];
$new_job->Created = $record['Created'];
$new_job->LastEdited = $record['LastEdited'];
$new_job->PostedDate = $record['JobPostedDate'];
$new_job->ExpirationDate = $record['ExpirationDate'];
// company name logic
$company_name = $record['JobCompany'];
$company = Company::get()->filter('Name', $company_name)->first();
$new_job->CompanyID = is_null($company) ? 0 : $company->ID;
if ($new_job->CompanyID == 0) {
$new_job->CompanyName = $company_name;
}
$new_job->MoreInfoLink = $record['JobMoreInfoLink'];
$new_job->Location = $record['JobLocation'];
$new_job->IsFoundationJob = $record['FoundationJob'];
$new_job->IsActive = $record['Active'];
$new_job->Instructions2Apply = $record['JobInstructions2Apply'];
$new_job->LocationType = $record['LocationType'];
$new_job->IsCOANeeded = 0;
$new_job->TypeID = 0;
//registration request
$registration_request = JobRegistrationRequest::get()->filter('Title', $new_job->Title)->first();
if (!is_null($registration_request)) {
$new_job->RegistrationRequestID = $registration_request->ID;
}
$new_job->write();
}
DBSchema::dropTable($database, "JobPage");
}
}
示例15: __construct
public function __construct($name, $title, $value = null)
{
$this->name = $name;
$this->title = $title;
$children = new FieldList();
$source = Company::get()->sort('Name')->map('ID', 'Name')->toArray();
$source['0'] = "-- New Company --";
$children->add($ddl = new DropdownField($name . '_id', $title, $source));
$ddl->setEmptyString('-- Select Your Company --');
$ddl->addExtraClass('select-company-name');
if (!is_null($value)) {
$c = Company::get()->filter('Name', $value)->first();
if ($c) {
$ddl->setValue($c->ID);
}
}
$children->add($txt = new TextField($name, ''));
$txt->addExtraClass('input-company-name');
parent::__construct($children);
$control_css_class = strtolower('company-composite');
$this->addExtraClass($control_css_class);
Requirements::javascript('openstack/code/utils/CustomHTMLFields/js/company.field.js');
Requirements::customScript("\n jQuery(document).ready(function(\$) {\n \$('.'+'{$control_css_class}').company_field();\n });");
}