Skip to content

Commit

Permalink
отчеты издательств
Browse files Browse the repository at this point in the history
  • Loading branch information
dp committed Mar 30, 2015
1 parent 6295cf0 commit dcb9f5a
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 45 deletions.
4 changes: 2 additions & 2 deletions Resource/Ice/Action/Data.tpl.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2><?= $title ?></h2>

<h2><?php if ($title) { ?><?= $title ?><?php } ?></h2>
<h3><?php if ($desc) { ?><?= $desc ?><?php } ?></h3>
<table class="table table-striped table-bordered table-hover table-condensed">
<?php foreach ($rows as $row) : ?>
<?= $row ?>
Expand Down
2 changes: 1 addition & 1 deletion Source/Ice/Action/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ public function run(array $input)
$rows[] = Php::getInstance()->fetch(Ui_Data::getClass($dataClass . '_' . $data->getRowDataTemplate()), ['columns' => $rowResult]);
}

return ['title' => $data->getTitle(), 'rows' => $rows];
return ['title' => $data->getTitle(), 'desc' => $data->getDesc(), 'rows' => $rows];
}
}
2 changes: 1 addition & 1 deletion Source/Ice/Core/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public static function fb($value, $label = null, $type = 'LOG', $options = [])
if (!Request::isCli() && !headers_sent() && Loader::load('FirePHP', false)) {
$varSize = Helper_Profiler::getVarSize($value);

if ($varSize > pow(2, 18)) {
if ($varSize > pow(2, 19)) {
$value = 'Very big data: ' . $varSize . ' bytes';
}

Expand Down
15 changes: 8 additions & 7 deletions Source/Ice/Core/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,8 @@ public static function getData(array $filterFields = [])
/**
* Return model by custom field
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param $fieldNames
* @param string|null $dataSourceKey
* @param int $ttl
Expand All @@ -826,13 +827,13 @@ public static function getData(array $filterFields = [])
* @version 0.4
* @since 0.0
*/
public static function getModelBy(array $fieldNameValues, $fieldNames, $dataSourceKey = null, $ttl = null)
public static function getModelBy($fieldName, $fieldValue, $fieldNames, $dataSourceKey = null, $ttl = null)
{
return Query::getBuilder(self::getClass())
->eq($fieldNameValues)
->eq([$fieldName => $fieldValue])
->limit(1)
->select($fieldNames, null, [], $dataSourceKey, $ttl)
->getModel();
->select($fieldNames, [], $dataSourceKey)
->getModel($ttl);
}

/**
Expand Down Expand Up @@ -1013,8 +1014,8 @@ public function find($fieldNames, $dataSourceKey = null, $ttl = null)

$row = Query::getBuilder($modelClass)
->eq($affected)
->select($selectFields, null, [], $dataSourceKey, $ttl)
->getRow();
->select($selectFields, [], $dataSourceKey)
->getRow($ttl);

if (!$row) {
return null;
Expand Down
71 changes: 39 additions & 32 deletions Source/Ice/Core/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ public function getModelClass()
return $this->_modelClass;
}


/**
* Append cache validate or invalidate tags for this query builder
*
Expand Down Expand Up @@ -538,7 +537,8 @@ public function in($fieldName, array $fieldValue, $modelTableData = [], $sqlLogi
/**
* Set in query part where expression '>= ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -548,11 +548,11 @@ public function in($fieldName, array $fieldValue, $modelTableData = [], $sqlLogi
* @version 0.6
* @since 0.0
*/
public function ge(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function ge($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_OPERATOR_GREATER_OR_EQUAL,
$modelTableData
);
Expand All @@ -561,7 +561,8 @@ public function ge(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
/**
* Set in query part where expression 'REGEXP ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -571,11 +572,11 @@ public function ge(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
* @version 0.6
* @since 0.4
*/
public function regex(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function regex($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_KEYWORD_REGEXP,
$modelTableData
);
Expand All @@ -584,7 +585,8 @@ public function regex(array $fieldNameValues, $modelTableData = [], $sqlLogical
/**
* Set in query part where expression '<= ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -594,11 +596,11 @@ public function regex(array $fieldNameValues, $modelTableData = [], $sqlLogical
* @version 0.6
* @since 0.0
*/
public function le(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function le($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_OPERATOR_LESS_OR_EQUAL,
$modelTableData
);
Expand All @@ -607,7 +609,8 @@ public function le(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
/**
* Set in query part where expression '> ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -617,11 +620,11 @@ public function le(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
* @version 0.6
* @since 0.0
*/
public function gt(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function gt($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_OPERATOR_GREATER,
$modelTableData
);
Expand All @@ -630,7 +633,8 @@ public function gt(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
/**
* Set in query part where expression '< ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -640,11 +644,11 @@ public function gt(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
* @version 0.6
* @since 0.0
*/
public function lt(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function lt($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_OPERATOR_LESS,
$modelTableData
);
Expand Down Expand Up @@ -689,7 +693,8 @@ public function notEmpty($fieldName, $modelTableData = [], $sqlLogical = Query_B
/**
* Set in query part where expression '<> ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -699,11 +704,11 @@ public function notEmpty($fieldName, $modelTableData = [], $sqlLogical = Query_B
* @version 0.6
* @since 0.0
*/
public function ne(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function ne($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_OPERATOR_NOT_EQUAL,
$modelTableData
);
Expand All @@ -712,7 +717,8 @@ public function ne(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
/**
* Set in query part where expression 'not in (?)'
*
* @param array $fieldNameValues
* @param $fieldName
* @param array $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -722,11 +728,11 @@ public function ne(array $fieldNameValues, $modelTableData = [], $sqlLogical = Q
* @version 0.6
* @since 0.0
*/
public function notIn(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function notIn($fieldName, array $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_KEYWORD_NOT_IN,
$modelTableData
);
Expand Down Expand Up @@ -771,7 +777,8 @@ public function not($fieldName, $modelTableData = [], $sqlLogical = Query_Builde
/**
* Set in query part where expression 'like ?'
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -781,11 +788,11 @@ public function not($fieldName, $modelTableData = [], $sqlLogical = Query_Builde
* @version 0.6
* @since 0.0
*/
public function like(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function like($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SQL_COMPARISON_KEYWORD_LIKE,
$modelTableData
);
Expand Down Expand Up @@ -1058,8 +1065,7 @@ private function _select($fieldName, $fieldAlias, $modelTableData)
* ];
* ```
*
* @param mixed $fieldName
* @param null $fieldAlias
* @param $fieldNames
* @param array $modelTableData
* @param string|null $dataSourceKey
* @return Query
Expand All @@ -1069,11 +1075,11 @@ private function _select($fieldName, $fieldAlias, $modelTableData)
* @version 0.6
* @since 0.0
*/
public function select($fieldName, $fieldAlias = null, $modelTableData = [], $dataSourceKey = null)
public function select($fieldNames, $modelTableData = [], $dataSourceKey = null)
{
$this->_queryType = Query_Builder::TYPE_SELECT;

$this->_select($fieldName, $fieldAlias, $modelTableData);
$this->_select($fieldNames, null, $modelTableData);

return $this->getQuery($dataSourceKey);
}
Expand Down Expand Up @@ -1583,7 +1589,8 @@ public function cloneBuilder()
/**
* Set in query part where expression for search
*
* @param array $fieldNameValues
* @param $fieldName
* @param $fieldValue
* @param array $modelTableData
* @param string $sqlLogical
* @return Query_Builder
Expand All @@ -1593,11 +1600,11 @@ public function cloneBuilder()
* @version 0.6
* @since 0.0
*/
public function search(array $fieldNameValues, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
public function search($fieldName, $fieldValue, $modelTableData = [], $sqlLogical = Query_Builder::SQL_LOGICAL_AND)
{
return $this->where(
$sqlLogical,
$fieldNameValues,
[$fieldName => $fieldValue],
Query_Builder::SEARCH_KEYWORD,
$modelTableData
);
Expand Down
19 changes: 18 additions & 1 deletion Source/Ice/Core/Ui/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ abstract class Ui_Data extends Container
*/
protected $_filterFields = [];

private $_title = 'Title';
private $_title = '';
private $_desc = '';
private $columns = [];
private $rows = [];
private $_rowHeaderTemplate = 'Row_Header';
Expand Down Expand Up @@ -247,5 +248,21 @@ public function setRowDataTemplate($rowDataTemplate)
return $this;
}

/**
* @return string
*/
public function getDesc()
{
return $this->_desc;
}

/**
* @param string $desc
* @return Ui_Data
*/
public function desc($desc)
{
$this->_desc = $desc;
return $this;
}
}
2 changes: 1 addition & 1 deletion Source/Ice/Form/Security/Login/Login/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function submit()
$_SESSION['userPk'] = $accountRow['user__fk'];
$_SESSION['roleNames'] = Query::getBuilder(User_Role_Link::getClass())
->inner('Ice:Role', 'role_name')
->eq(['user__fk' => $accountRow['user__fk']])
->eq(['user__fk', $accountRow['user__fk']])
->select('role_name')->getColumn();
return;
}
Expand Down

0 comments on commit dcb9f5a

Please sign in to comment.