當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Company::findAll方法代碼示例

本文整理匯總了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);
 }
開發者ID:scandio,項目名稱:troba,代碼行數:7,代碼來源:ModelFindersTest.php

示例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;
開發者ID:jeffreycai,項目名稱:chaoliu,代碼行數:19,代碼來源:company_list.php

示例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;
    }
開發者ID:jeffreycai,項目名稱:chaoliu,代碼行數:65,代碼來源:SiteUser.class.php


注:本文中的Company::findAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。