Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1246127
D228.id535.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 21, 9:57 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Sat, Nov 22, 9:57 AM (18 h, 15 m)
Engine
blob
Format
Raw Data
Handle
809377
Attached To
D228: INP-1551 Add the "kDBList::GetSelectedCount" method and "SelectedRecords" tag using it
D228.id535.diff
View Options
Index: core/kernel/db/db_tag_processor.php
===================================================================
--- core/kernel/db/db_tag_processor.php
+++ core/kernel/db/db_tag_processor.php
@@ -2035,6 +2035,9 @@
case 'total':
return $object->GetRecordsCount(false);
+ case 'selected':
+ return $object->GetSelectedCount();
+
case 'from':
return $object->GetRecordsCount() ? $object->GetOffset() + 1 : 0; //0-based
@@ -2225,6 +2228,20 @@
}
/**
+ * Print selected records count.
+ *
+ * @param array $params Tag params.
+ *
+ * @return string
+ */
+ protected function SelectedRecords(array $params)
+ {
+ $list =& $this->GetList($params);
+
+ return $list->GetSelectedCount();
+ }
+
+ /**
* Range filter field name
*
* @param Array $params
Index: core/kernel/db/dblist.php
===================================================================
--- core/kernel/db/dblist.php
+++ core/kernel/db/dblist.php
@@ -450,7 +450,7 @@
*/
public function GetRecordsCount($with_filters = true)
{
- if (!$this->Counted) {
+ if ( !$this->Counted ) {
$this->CountRecs();
}
@@ -465,6 +465,10 @@
*/
public function GetSelectedCount()
{
+ if ( !$this->Queried ) {
+ $this->Query();
+ }
+
return $this->SelectedCount;
}
Event Timeline
Log In to Comment