本文整理汇总了PHP中Companies类的典型用法代码示例。如果您正苦于以下问题:PHP Companies类的具体用法?PHP Companies怎么用?PHP Companies使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Companies类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getCompaniesByProjects
/**
* Return all companies that are on specific projects, determined by a CVS list of project ids.
*
* @access public
* @param string $projects_csv CSV list of projects
* @param string $additional_conditions Additional SQL conditions
* @param bool $include_owner Include the owner company
* @return array Array of Companies
*/
static function getCompaniesByProjects($projects_csv, $additional_conditions = null, $include_owner = true)
{
$companies = array();
$companies_table = Companies::instance()->getTableName(true);
$project_companies_table = ProjectCompanies::instance()->getTableName(true);
// Restrict result only on owner company
$ownerCond = '';
if (!$include_owner) {
$owner_id = owner_company()->getId();
$ownerCond = "{$companies_table}.`client_of_id` = '{$owner_id}' AND ";
}
$sql = "SELECT {$companies_table}.* FROM {$companies_table}, {$project_companies_table} WHERE {$ownerCond} ({$companies_table}.`id` = {$project_companies_table}.`company_id` AND {$project_companies_table}.`project_id` IN ( " . $projects_csv . '))';
if (trim($additional_conditions) != '') {
$sql .= " AND ({$additional_conditions}) ORDER BY {$companies_table}.`name`";
}
$rows = DB::executeAll($sql);
if (is_array($rows)) {
foreach ($rows as $row) {
$companies[] = Companies::instance()->loadFromRow($row);
}
// foreach
}
// if
return count($companies) ? $companies : null;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:34,代码来源:ProjectCompanies.class.php
示例2: __construct
/**
* Constructor
*
* @param Request $request
* @return CompanyProfileController
*/
function __construct($request)
{
parent::__construct($request);
$company_id = $this->request->getId('company_id');
if ($company_id) {
$this->active_company = Companies::findById($company_id);
}
// if
if (instance_of($this->active_company, 'Company')) {
$this->wireframe->page_actions = array();
if (!$this->active_company->canView($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
if ($this->active_company->getIsArchived() && $this->logged_user->isPeopleManager()) {
$this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('people_archive'));
}
// if
$this->wireframe->addBreadCrumb($this->active_company->getName(), $this->active_company->getViewUrl());
// Collect company tabs
$tabs = new NamedList();
$tabs->add('overview', array('text' => str_excerpt($this->active_company->getName(), 25), 'url' => $this->active_company->getViewUrl()));
$tabs->add('people', array('text' => lang('People'), 'url' => $this->active_company->getViewUrl()));
$tabs->add('projects', array('text' => lang('Projects'), 'url' => $this->active_company->getViewUrl()));
event_trigger('on_company_tabs', array(&$tabs, &$this->logged_user, &$this->active_company));
$this->smarty->assign(array('company_tabs' => $tabs, 'company_tab' => 'overview'));
} else {
$this->active_company = new Company();
}
// if
$this->smarty->assign(array('active_company' => $this->active_company));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:CompaniesController.class.php
示例3: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id = NULL)
{
$currUser = Auth::user();
$oCategories = Category::all();
$oCity = Cities::all();
$oVacancy = null;
if ($id > 0) {
$oVacancy = Vacancy::find($id);
}
foreach ($oCategories as $item) {
$aCategories[$item->id] = $item->name;
}
if (Auth::user()->is_admin == 0) {
$aCompanies = Companies::where('user_id', '=', $currUser->id)->get();
} else {
$aCompanies = Companies::all();
}
foreach ($aCompanies as $item) {
$aCompany[$item->id] = $item->name;
}
$oQuery = Regions::join('country', 'country.id', '=', 'country_id')->select('regions.id as id', 'regions.name', 'country.name as country_name', 'country.id as country_id');
if ($oRegions = $oQuery->get()) {
}
foreach ($oRegions as $item) {
$aRegions[$item->country_name] = array();
$aCity = Cities::where('region_id', '=', $item->id)->get();
foreach ($aCity as $city) {
$aRegions[$item->name][$city->id] = $city->name;
}
}
if ($currUser->is_admin == 0 && (empty($oVacancy) === false && $oVacancy->user_id != $currUser->id)) {
return Redirect::route('vacancy-list', array('user_id' => $currUser->id));
}
return View::make('/vacancy/edit', array('currUser' => $currUser, 'aCategories' => $aCategories, 'aCompany' => $aCompany, 'aRegions' => $aRegions, 'oVacancy' => $oVacancy, 'id' => $id));
}
开发者ID:sergey-donchenko,项目名称:hr-agency,代码行数:41,代码来源:VacancyController.php
示例4: initCompany
/**
* Init company based on subdomain
*
* @access public
* @param string
* @return null
* @throws Error
*/
private function initCompany()
{
$company = Companies::getOwnerCompany();
if (!$company instanceof Company) {
throw new OwnerCompanyDnxError();
}
// if
// check the cache if available
$owner = null;
if (GlobalCache::isAvailable()) {
$owner = GlobalCache::get('owner_company_creator', $success);
}
if (!$owner instanceof User) {
$owner = $company->getCreatedBy();
// Update cache if available
if ($owner instanceof User && GlobalCache::isAvailable()) {
GlobalCache::update('owner_company_creator', $owner);
}
}
if (!$owner instanceof User) {
throw new AdministratorDnxError();
}
// if
$this->setCompany($company);
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:33,代码来源:CompanyWebsite.class.php
示例5: getCompany
/**
* Return invoice company
*
* @param void
* @return Company
*/
function getCompany()
{
if ($this->company === false) {
$this->company = Companies::findById($this->getCompanyId());
}
// if
return $this->company;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:14,代码来源:Invoice.class.php
示例6: getCompany
/**
* Return relation company
*
* @param void
* @return Company
*/
function getCompany()
{
if (is_null($this->company)) {
$this->company = Companies::findById($this->getCompanyId());
}
// if
return $this->company;
}
开发者ID:ukd1,项目名称:Project-Pier,代码行数:14,代码来源:ProjectCompany.class.php
示例7: check_fed_id
/**
* Check Fed ID rule
*/
public function check_fed_id() {
$company = Companies::model()->find('Company_Fed_ID=:Fed_ID',
array(':Fed_ID'=>$this->Fed_ID));
if($company != null) {
$this->addError('Fed_ID','Company with this Fed ID already exists');
} else if (!preg_match('/^(\d{2}\-\d{7})|(\d{3}\-\d{2}\-\d{4})$/', $this->Fed_ID)) {
$this->addError('Fed_ID','Invalid Fed ID, correct formatting: xx-xxxxxxx');
}
}
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:12,代码来源:NewCompanyForm.php
示例8: smarty_function_select_company
/**
* Render select company box
*
* Parameters:
*
* - value - Value of selected company
* - optional - Is value of this field optional or not
* - exclude - Array of company ID-s that will be excluded
* - can_create_new - Should this select box offer option to create a new
* company from within the list
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_company($params, &$smarty)
{
static $ids = array();
$companies = Companies::getIdNameMap(array_var($params, 'companies'));
$value = array_var($params, 'value', null, true);
$id = array_var($params, 'id', null, true);
if (empty($id)) {
$counter = 1;
do {
$id = "select_company_dropdown_{$counter}";
$counter++;
} while (in_array($id, $ids));
}
// if
$ids[] = $id;
$params['id'] = $id;
$optional = array_var($params, 'optional', false, true);
$exclude = array_var($params, 'exclude', array(), true);
if (!is_array($exclude)) {
$exclude = array();
}
// if
$can_create_new = array_var($params, 'can_create_new', true, true);
if ($optional) {
$options = array(option_tag(lang('-- None --'), ''), option_tag('', ''));
} else {
$options = array();
}
// if
foreach ($companies as $company_id => $company_name) {
if (in_array($company_id, $exclude)) {
continue;
}
// if
$option_attributes = array('class' => 'object_option');
if ($value == $company_id) {
$option_attributes['selected'] = true;
}
// if
$options[] = option_tag($company_name, $company_id, $option_attributes);
}
// if
if ($can_create_new) {
$logged_user = get_logged_user();
if (instance_of($logged_user, 'User') && Company::canAdd($logged_user)) {
$params['add_object_url'] = assemble_url('people_companies_quick_add');
$params['object_name'] = 'company';
$params['add_object_message'] = lang('Please insert new company name');
$options[] = option_tag('', '');
$options[] = option_tag(lang('New Company...'), '', array('class' => 'new_object_option'));
}
// if
}
// if
return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:71,代码来源:function.select_company.php
示例9: run
public function run()
{
// Uncomment the below to wipe the table clean before populating
// DB::table('companies')->truncate();
Eloquent::unguard();
DB::table('companies')->delete();
Companies::create(array('id' => 1, 'name' => 'АТБ', 'description' => 'Продуктовый супермаркет', 'phone' => 123456789, 'email' => '[email protected]', 'web_site' => 'web.site.ua', 'city_id' => 3, 'user_id' => 1, 'cover_image' => '', 'logo' => ''));
Companies::create(array('id' => 2, 'name' => 'Фокстрот', 'description' => 'Супермаркет електронной техники', 'phone' => 0516155555, 'email' => 'fokstroy@ua', 'web_site' => 'fokstrot.ua', 'city_id' => 2, 'user_id' => 1, 'cover_image' => '', 'logo' => ''));
Companies::create(array('id' => 3, 'name' => 'Web-studio', 'description' => 'Web-studio, создание и продвижение сайтов', 'phone' => 0656565655, 'email' => '[email protected]', 'web_site' => 'web.ua', 'city_id' => 1, 'user_id' => 1, 'cover_image' => '', 'logo' => ''));
$this->command->info('Companies table seeded!');
}
开发者ID:sergey-donchenko,项目名称:hr-agency,代码行数:11,代码来源:CompaniesTableSeeder.php
示例10: check_auth
/**
* Check Auth_Code rule
*/
public function check_auth() {
$client = Clients::model()->findByPk($this->Client_ID);
if($client) {
$company = Companies::model()->findByPk($client->Company_ID);
if ($company->Auth_Code != $this->Auth_Code) {
$this->addError('Auth_Code','Invalid Authorization Code');
}
} else {
$this->addError('Auth_Code',"Company with this Authorization Code doesn't exists");
}
}
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:14,代码来源:RegisterAsClientAdminForm.php
示例11: initCompany
/**
* Init company based on subdomain
*
* @access public
* @param string
* @return null
* @throws Error
*/
private function initCompany()
{
$company = Companies::getOwnerCompany();
if (!$company instanceof Company) {
throw new OwnerCompanyDnxError();
}
// if
if (!$company->getCreatedBy() instanceof User) {
throw new AdministratorDnxError();
}
// if
$this->setCompany($company);
}
开发者ID:swenson,项目名称:projectpier,代码行数:21,代码来源:CompanyWebsite.class.php
示例12: get_owner_company
/**
* Return owner company instance
*
* @param void
* @return Company
*/
function get_owner_company()
{
static $instance = null;
if ($instance === null) {
$instance = cache_get('owner_company');
if (!$instance) {
$instance = Companies::findOwnerCompany();
}
// if
}
// if
return $instance;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:19,代码来源:init.php
示例13: archive
/**
* Show archive page
*
* @param void
* @return null
*/
function archive()
{
if ($this->logged_user->isPeopleManager()) {
$this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('people_archive'));
$page = (int) $this->request->get('page');
if ($page < 1) {
$page = 1;
}
// if
list($companies, $pagination) = Companies::paginateArchived($this->logged_user, $page, 30);
$this->smarty->assign(array('companies' => $companies, 'pagination' => $pagination));
} else {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:22,代码来源:PeopleController.class.php
示例14: initCompany
/**
* Init company based on subdomain
*
* @access public
* @param string
* @return null
* @throws Error
*/
private function initCompany()
{
trace(__FILE__, 'initCompany()');
$company = Companies::getOwnerCompany();
trace(__FILE__, 'initCompany() - company check');
if (!$company instanceof Company) {
throw new OwnerCompanyDnxError();
}
// if
trace(__FILE__, 'initCompany() - admin check');
if (!$company->getCreatedBy() instanceof User) {
throw new AdministratorDnxError();
}
// if
trace(__FILE__, 'initCompany() - setCompany()');
$this->setCompany($company);
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:25,代码来源:CompanyWebsite.class.php
示例15: company
/**
* Display company details
*
*/
function company()
{
$current_company = Companies::findById($this->request->get('object_id'));
if (!instance_of($current_company, 'Company')) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$current_company->isOwner() && !in_array($current_company->getId(), $this->logged_user->visibleCompanyIds())) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
$users = $current_company->getUsers($this->logged_user->visibleUserIds());
if (!$current_company->isOwner()) {
$projects = Projects::findByUserAndCompany($this->logged_user, $current_company);
}
$this->smarty->assign(array('current_company' => $current_company, 'current_company_users' => $users, 'current_company_projects' => $projects, "page_title" => $current_company->getName(), "page_back_url" => assemble_url('mobile_access_people')));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:21,代码来源:MobileAccessPeopleController.class.php
示例16: getGroupedByCompany
/**
* Return contacts grouped by company
*
* @param void
* @return array
*/
static function getGroupedByCompany()
{
$companies = Companies::getAll();
if (!is_array($companies) || !count($companies)) {
return null;
}
// if
$result = array();
foreach ($companies as $company) {
$contacts = $company->getContacts();
if (is_array($contacts) && count($contacts)) {
$result[$company->getName()] = array('details' => $company, 'contacts' => $contacts);
// array
}
// if
}
// foreach
return count($result) ? $result : null;
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:25,代码来源:Contacts.class.php
示例17: getCompaniesByProject
/**
* Return all companies that are on specific project. Owner company is excluded from
* this listing (only client companies are returned)
*
* @access public
* @param Project $project
* @param string $additional_conditions Additional SQL conditions
* @return array
*/
static function getCompaniesByProject(Project $project, $additional_conditions = null)
{
$companies_table = Companies::instance()->getTableName(true);
$project_companies_table = ProjectCompanies::instance()->getTableName(true);
// Restrict result only on owner company
$owner_id = owner_company()->getId();
$companies = array();
$sql = "SELECT {$companies_table}.* FROM {$companies_table}, {$project_companies_table} WHERE ({$companies_table}.`client_of_id` = '{$owner_id}') AND ({$companies_table}.`id` = {$project_companies_table}.`company_id` AND {$project_companies_table}.`project_id` = " . DB::escape($project->getId()) . ')';
if (trim($additional_conditions) != '') {
$sql .= " AND ({$additional_conditions})";
}
$rows = DB::executeAll($sql);
if (is_array($rows)) {
foreach ($rows as $row) {
$companies[] = Companies::instance()->loadFromRow($row);
}
// foreach
}
// if
return count($companies) ? $companies : null;
}
开发者ID:469306621,项目名称:Languages,代码行数:30,代码来源:ProjectCompanies.class.php
示例18: getUpdate
public function getUpdate($idCourse, $idContent = '')
{
if ($idContent == '') {
return Redirect::to(self::parseRoute($idCourse));
} else {
$content = CoursesSection::find($idContent);
if (!$content) {
return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_display_err'));
} else {
$course = Courses::find($idCourse);
$array = array('course' => $course, 'content' => $content, 'route' => self::parseRoute($idCourse));
$view = null;
switch ($content->section->type) {
case 'text':
$view = 'backend.content.section';
break;
case 'teachers':
$array['teachers'] = Teachers::getPublish();
$view = 'backend.content.teachers';
break;
case 'helpers':
$array['helpers'] = Companies::getPublish();
$view = 'backend.content.helpers';
break;
case 'promotioners':
$array['promotioners'] = Companies::getPublish();
$view = 'backend.content.promotioners';
break;
case 'supporters':
$array['supporters'] = Companies::getPublish();
$view = 'backend.content.supporters';
break;
default:
$view = 'backend.content.section';
break;
}
return View::make($view, $array);
}
}
}
开发者ID:nagyist,项目名称:abge,代码行数:40,代码来源:ContentController.php
示例19: company
/**
* Show billed / canceled company invoices
*
* @param void
* @return null
*/
function company()
{
$status = $this->request->get('status') ? $this->request->get('status') : 'billed';
$company = null;
$company_id = $this->request->getId('company_id');
if ($company_id) {
$company = Companies::findById($company_id);
}
// if
if (instance_of($company, 'Company')) {
$this->wireframe->addBreadCrumb($company->getName(), assemble_url('company_invoices', array('company_id' => $company->getId())));
} else {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if ($status == 'canceled') {
$invoices = group_invoices_by_currency(Invoices::findByCompany($company, array(INVOICE_STATUS_CANCELED), 'closed_on DESC'));
} else {
$invoices = group_invoices_by_currency(Invoices::findByCompany($company, array(INVOICE_STATUS_BILLED), 'closed_on DESC'));
}
// if
$this->smarty->assign(array('company' => $company, 'invoices' => $invoices, 'status' => $status));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:29,代码来源:InvoicesArchiveController.class.php
示例20: getCompany
/**
* Return owner company
*
* @access public
* @param void
* @return Company
*/
function getCompany()
{
return Companies::findById($this->getCompanyId());
}
开发者ID:ukd1,项目名称:Project-Pier,代码行数:11,代码来源:User.class.php
注:本文中的Companies类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论