本文整理汇总了PHP中Companies::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::findAll方法的具体用法?PHP Companies::findAll怎么用?PHP Companies::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Companies
的用法示例。
在下文中一共展示了Companies::findAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFavorites
/**
* Return favorite companies
*
* @param void
* @return array
*/
static function getFavorites()
{
return Companies::findAll(array('conditions' => array('`is_favorite` = ?', 1), 'order' => '`id`'));
}
示例2: getCompanyClients
/**
* Return company clients
*
* @param Company $company
* @return array
*/
static function getCompanyClients(Company $company)
{
return Companies::findAll(array('conditions' => array('`client_of_id` = ?', $company->getId()), 'order' => '`name`'));
// array
}
示例3: am
if ($do == "edit") {
if (!empty($id)) {
$sql = "SELECT c.*,m.username,m.membergroup_id,m.credits FROM {$tb_prefix}companies c LEFT JOIN {$tb_prefix}members m ON c.member_id=m.id WHERE c.id=" . $id;
$res = $pdb->GetRow($sql);
$r1 = $industry->disSubOptions($res['industry_id'], "industry_");
$r2 = $area->disSubOptions($res['area_id'], "area_");
$res = am($res, $r1, $r2);
setvar("item", $res);
$selected['properties'] = explode(",", $res['manage_type']);
setvar("SelectedManageType", $selected['properties']);
$selected['markets'] = explode(",", $res['main_market']);
setvar("SelectedMarket", $selected['markets']);
}
uaAssign(array("CompanyProperty" => $_PB_CACHE['economic_type'], "ManageTypes" => $_PB_CACHE['manage_type'], "MainMarkets" => $_PB_CACHE['main_market'], "CompanyFunds" => $_PB_CACHE['reg_fund'], "CompanyAnual" => $_PB_CACHE['year_annual'], "LinkmanPositions" => $_PB_CACHE['position'], "EmployeeAmounts" => $_PB_CACHE['employee_amount'], "Genders" => $_PB_CACHE['gender']));
$tpl_file = "company.edit";
template($tpl_file);
exit;
}
}
$fields = "Company.id,m.space_name,Company.cache_spacename,m.membergroup_id,m.credits,member_id,m.username,Company.name AS CompanyName,Company.status AS CompanyStatus,Company.created AS pubdate,Company.if_commend,Company.area_id,industry_id,cache_credits";
$total_amount = $pdb->CacheGetOne(120, "SELECT COUNT(id) AS amount FROM " . $tb_prefix . "companies WHERE status='0'");
$amount = $company->findCount(null, $conditions, "Company.id");
$page->setPagenav($amount);
$joins = array();
$joins[] = "LEFT JOIN {$tb_prefix}members m ON m.id=Company.member_id";
if (empty($lists)) {
$lists = $company->findAll($fields, $joins, $conditions, "Company.id DESC", $page->firstcount, $page->displaypg);
}
setvar("Items", $lists);
uaAssign(array("ByPages" => $page->pagenav, "TotalAmount" => $total_amount));
template($tpl_file);
示例4: allowed_users_view_events
function allowed_users_view_events()
{
$comp_array = array();
$actual_user_id = isset($_GET['user']) ? $_GET['user'] : logged_user()->getId();
$wspace_id = isset($_GET['ws_id']) ? $_GET['ws_id'] : 0;
$ws = Projects::findByCSVIds($wspace_id);
$evid = array_var($_GET, 'evid');
$companies = Companies::findAll();
$i = 0;
foreach ($companies as $comp) {
$users = $comp->getUsersOnWorkspaces($ws);
if (is_array($users)) {
foreach ($users as $k => $user) {
// removing event creator from notification list
$keep = false;
foreach ($ws as $w) {
if (can_read_type($user, $w, 'ProjectEvents')) {
$keep = true;
}
}
if (!$keep) {
unset($users[$k]);
}
}
if (count($users) > 0) {
$comp_data = array('id' => $i++, 'object_id' => $comp->getId(), 'name' => $comp->getName(), 'logo_url' => $comp->getLogoUrl(), 'users' => array());
foreach ($users as $user) {
$comp_data['users'][] = array('id' => $user->getId(), 'name' => $user->getDisplayName(), 'avatar_url' => $user->getAvatarUrl(), 'invited' => $evid == 0 ? $user->getId() == $actual_user_id : EventInvitations::findOne(array('conditions' => "`event_id` = {$evid} and `user_id` = " . $user->getId())) != null, 'mail' => $user->getEmail());
}
$comp_array[] = $comp_data;
}
}
}
$object = array("totalCount" => count($comp_array), "start" => 0, "companies" => array());
$object['companies'] = $comp_array;
ajx_extra_data($object);
ajx_current("empty");
}
示例5: getAssignableCompanies
function getAssignableCompanies($project = null)
{
if ($this->isMemberOfOwnerCompany()) {
return Companies::getCompaniesWithUsers();
}
TimeIt::start('get assignable companies');
if ($project instanceof Project) {
$ws = $project->getAllSubWorkspacesQuery(true);
}
$uid = $this->getId();
$cid = $this->getCompany()->getId();
$tp = TABLE_PREFIX;
$gids = "SELECT `group_id` FROM `{$tp}group_users` WHERE `user_id` = {$uid}";
$q1 = "SELECT `project_id` FROM `{$tp}project_users` WHERE (`user_id` = {$uid} OR `user_id` IN ({$gids})) AND `can_assign_to_other` = '1'";
$q2 = "SELECT `project_id` FROM `{$tp}project_users` WHERE (`user_id` = {$uid} OR `user_id` IN ({$gids})) AND `can_assign_to_owners` = '1'";
if (isset($ws)) {
$q1 .= " AND `project_id` IN ({$ws})";
$q2 .= " AND `project_id` IN ({$ws})";
}
$query1 = "SELECT `user_id` FROM `{$tp}project_users` WHERE `project_id` IN ({$q1})";
$query2 = "SELECT `user_id` FROM `{$tp}project_users` WHERE `project_id` IN ({$q2})";
$query = "SELECT `company_id` FROM `{$tp}users` WHERE `id` IN ({$query1}) AND `company_id` <> 1 AND `company_id` <> {$cid} OR `id` IN ({$query2}) AND `company_id` = 1";
// get companies for assignable users (see getAssignableUsers)
$companies = Companies::findAll(array('conditions' => "`id` = {$cid} OR `id` IN ({$query})"));
TimeIt::stop();
return $companies;
}
示例6: allowed_users_to_assign
function allowed_users_to_assign($wsid)
{
$ws = Projects::findById($wsid);
$comp_array = array();
$companies = Companies::findAll();
if ($companies != null) {
foreach ($companies as $comp) {
if ($ws != null) {
$users = $comp->getUsersOnProject($ws);
} else {
continue;
}
if (is_array($users)) {
foreach ($users as $k => $user) {
// if logged_user can assign tasks to user and user can read tasks the user is allowed
if (!can_assign_task(logged_user(), $ws, $user) || !can_read_type($user, $ws, 'ProjectTasks')) {
unset($users[$k]);
}
}
if (count($users) > 0) {
$comp_data = array('id' => $comp->getId(), 'name' => $comp->getName(), 'users' => array());
foreach ($users as $user) {
$comp_data['users'][] = $user->getArrayInfo();
}
//if ($ws == null || can_assign_task(logged_user(), $ws, $comp)) {
if (count($users) > 0) {
$comp_array[] = $comp_data;
}
}
}
}
}
return $comp_array;
}