本文整理汇总了PHP中Company::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::findAll方法的具体用法?PHP Company::findAll怎么用?PHP Company::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::findAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFindAll
public function testFindAll()
{
$cq = EQM::query(Company::class)->result();
$cm = Company::findAll();
$this->assertEquals($cq->count(), $cm->count());
$this->assertEquals($cq->one()->name, $cm->one()->name);
}
示例2: isset
<?php
$page = isset($_GET['page']) ? $_GET['page'] : 1;
if (!preg_match('/^\\d+$/', $page)) {
dispatch('core/backend/404');
exit;
}
$objects = Company::findAll();
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Company', 'zh' => '公司'))), true);
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$perpage = 50;
$total = Company::countAll();
$total_page = ceil($total / $perpage);
$html->renderOut('company/backend/company_list', array('objects' => Company::findAllWithPage($page, $perpage), 'current_page' => $page, 'total_page' => $total_page, 'total' => $total, 'pager' => $html->render('core/components/pagination', array('total' => $total_page, 'page' => $page)), 'start_entry' => ($page - 1) * $perpage + 1, 'end_entry' => min(array($total, $page * $perpage))), true);
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
exit;
示例3: renderUpdateFormBackend
static function renderUpdateFormBackend(SiteUser $user = null, $action = '')
{
// set default action value
if ($action != '') {
$action = uri($action);
}
// get vars from form submission
$username = isset($_POST['username']) ? strip_tags($_POST['username']) : (isset($user) ? $user->getUsername() : '');
$email = isset($_POST['email']) ? strip_tags($_POST['email']) : (isset($user) ? $user->getEmail() : '');
$password = '';
$password_confirm = '';
$active = isset($_POST['active']) ? strip_tags($_POST['active']) : (isset($user) ? $user->getActive() : false);
$company_id = isset($_POST['company_id']) ? strip_tags($_POST['company_id']) : (isset($user) ? $user->getCompanyId() : '');
$company_options = "";
foreach (Company::findAll() as $company) {
$id = $company->getId();
$name = $company->getName();
$company_options .= "<option value='{$id}' " . ($id == $company_id ? 'selected' : '') . ">{$name}</option>";
}
$mandatory_label = ' <span style="color: rgb(185,2,0); font-weight: bold;">*</span>';
$roles_form_markup = '<div id="form-field-roles"><label>Roles</label><ul class="checkbox">';
foreach (SiteRole::findAll() as $role) {
$roles_form_markup .= '<li><label><input type="checkbox" name="roles[' . $role->getid() . ']" value=1 ' . (isset($_POST['roles']) ? isset($_POST['roles'][$role->getId()]) ? 'checked="checked"' : '' : ($user && $user->hasRole($role->getName()) ? 'checked="checked"' : '')) . ' />' . $role->getName() . '</label></li>';
}
$roles_form_markup .= '</ul></div>';
$rtn = '
<form action="' . $action . '" method="POST" id="adduser" enctype="multipart/form-data">
<div class="form-group" id="form-field-username">
<label for="username">' . i18n(array('en' => 'Username', 'zh' => '用户名')) . $mandatory_label . ' <small style="font-weight: normal;"><i>(' . i18n(array('en' => 'alphabetical letters, number or underscore', 'zh' => '英文字母,数字或下划线')) . ')</i></small></label>
<input type="text" class="form-control" id="username" name="username" value="' . $username . '" required placeholder="" />
</div>
<div class="form-group" id="form-field-company">
<label for="company">' . i18n(array('en' => 'Company', 'zh' => '公司')) . $mandatory_label . '</label>
<select class="form-control" name="company_id">
' . $company_options . '
</select>
</div>
<div class="form-group" id="form-field-email" >
<label for="email">' . i18n(array('en' => 'Email', 'zh' => '电子邮箱')) . $mandatory_label . '</label>
<input type="email" class="form-control" id="email" name="email" value="' . $email . '" required />
</div>
<div class="form-group" id="form-field-password">
<label for="password">' . i18n(array('en' => 'Password', 'zh' => '密码')) . $mandatory_label . ' <small style="font-weight: normal;"><i>(' . i18n(array('en' => 'at least 6 letters', 'zh' => '至少6位')) . ')</i></small></label>
<input type="password" class="form-control" id="password" name="password" value="' . $password . '" required />
</div>
<div class="form-group" id="form-field-password_confirm">
<label for="password_confirm">' . i18n(array('en' => 'Password again', 'zh' => '再次确认密码')) . $mandatory_label . '</label>
<input type="password" class="form-control" id="password_confirm" name="password_confirm" value="' . $password_confirm . '" required />
</div>
' . (class_exists('SiteProfile') ? SiteProfile::renderUpdateForm($user) : '') . '
<div class="checkbox" id="form-field-active">
<label>
<input type="checkbox" id="active" name="active" value="1" ' . ($active == false ? '' : 'checked="checked"') . '> ' . i18n(array('en' => 'Active?', 'zh' => '有效用户')) . '
</label>
</div>
<input type="hidden" value=1 name="noemailnotification" />
' . (is_backend() ? $roles_form_markup : '') . '
<div class="form-group" id="form-field-notice"><small><i>
' . $mandatory_label . i18n(array('en' => ' indicates mandatory fields', 'zh' => ' 标记为必填项')) . '
</i></small></div>
<button type="submit" name="submit" class="btn btn-primary">' . (is_null($user) ? i18n(array('en' => 'Add new user', 'zh' => '添加新用户')) : i18n(array('en' => 'Update user', 'zh' => '更新用户'))) . '</button>
</form>
';
return $rtn;
}