本文整理匯總了PHP中Control::primary方法的典型用法代碼示例。如果您正苦於以下問題:PHP Control::primary方法的具體用法?PHP Control::primary怎麽用?PHP Control::primary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Control
的用法示例。
在下文中一共展示了Control::primary方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct()
{
if (!$control) {
$control = Control::primary();
}
$this->control = $control;
$this->lt = $control->lt;
$this->db = $this->control->db;
}
示例2: __construct
function __construct($control = null)
{
if (!$control) {
$control = Control::primary();
}
$this->control = $control;
$this->protocol = $_ENV['protocol'] ? $_ENV['protocol'] : 'http';
$this->baseUrl = $this->protocol . '://' . $_ENV['httpHost'] . '/';
}
示例3: page
static function page($sql, $pageNumber = null, $pageBy = 50, $max = null)
{
$pageBy = $pageBy ? $pageBy : 50;
if ($pageNumber === null) {
$control = \Control::primary();
$pageNumber = (int) $control->in['_page'] - 1;
}
$pageNumber = $pageNumber > 0 ? $pageNumber : 0;
$offset = $pageBy * $pageNumber;
$sql .= "\nLIMIT " . $offset . ', ' . $pageBy;
list($count, $rows) = \Db::countAndRows($max ? $max + 1 : null, $sql);
$top = $count;
if ($max && $count > $max) {
$top = $max;
}
$pages = ceil($top / $pageBy);
self::$lastPaging = array('rows' => $rows, 'info' => array('count' => $count, 'pages' => $pages, 'top' => $top, 'page' => $pageNumber + 1));
return self::$lastPaging;
}
示例4: __construct
function __construct($data = null, $options = null)
{
$this->control = \Control::primary();
$this->in = $this->control->in;
///an array of keys to values used in conjuction with TO_ARRAY to serve as override values for form fields
if (!is_array($data)) {
if ($this->in) {
$this->data = $this->in;
} else {
$this->data = $this->control->item;
}
} else {
$this->data = $data;
}
///the the of behavior for determining what the actual value of a form field should be
$this->valueBehavior = $options['valueBehavior'] ? $options['valueBehavior'] : 'to_input';
///attribute parsers to apply when handling options on form method
$this->additionalParsers = $options['additionalParsers'];
}
示例5: __construct
function __construct($control = null)
{
$this->control = $control ? $control : Control::primary();
}