本文整理汇总了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();
}