Exemplo n.º 1
0
 /**
  * Overriding to prefix the key with model name
  * @param string $key
  * @param array $data
  */
 public static function setDataByKeyAndData($key, array $data)
 {
     parent::setDataByKeyAndData('report_' . $key, $data);
 }
Exemplo n.º 2
0
 public function testRestoreSelectedOptionsAsStickyData()
 {
     $key = MashableUtil::resolveKeyByModuleAndModel('MashableInboxModule', 'testClassName');
     StickyUtil::clearDataByKey($key);
     $mashableInboxForm = MashableUtil::restoreSelectedOptionsAsStickyData('testClassName');
     $mashableInboxFormForCompare = new MashableInboxForm();
     $this->assertEquals($mashableInboxFormForCompare->attributes, $mashableInboxForm->attributes);
     $testData = array('optionForModel' => 'aaaaa', 'filteredBy' => 'bbbbb', 'searchTerm' => 'ccccc');
     $key = MashableUtil::resolveKeyByModuleAndModel('MashableInboxModule', 'testClassName');
     StickyUtil::clearDataByKey($key);
     StickyUtil::setDataByKeyAndData($key, $testData);
     $mashableInboxForm = MashableUtil::restoreSelectedOptionsAsStickyData('testClassName');
     $this->assertEquals($testData, array_intersect($testData, StickyUtil::getDataByKey($key)));
 }
Exemplo n.º 3
0
 public static function resolveSortFromStickyData($getArrayPrefixName, $uniqueLayoutId)
 {
     $key = $uniqueLayoutId;
     $sortAttribute = static::resolveSortAttributeFromGetArray($getArrayPrefixName);
     $sortDescending = static::resolveSortDescendingFromGetArray($getArrayPrefixName);
     if (!$sortAttribute) {
         $stickyData = StickyUtil::getDataByKey($key);
         $sortAttribute = $stickyData[0];
         $sortDescending = $stickyData[1] ? $stickyData[1] : false;
         return array($sortAttribute, $sortDescending);
     }
     StickyUtil::setDataByKeyAndData($key, array($sortAttribute, $sortDescending));
     return array($sortAttribute, $sortDescending);
 }
Exemplo n.º 4
0
 public static function restoreSelectedOptionsAsStickyData($modelClassName)
 {
     assert('strlen($modelClassName) > 0 || ($modelClassName === null)');
     $key = self::resolveKeyByModuleAndModel('MashableInboxModule', $modelClassName);
     $data = StickyUtil::getDataByKey($key);
     $mashableInboxForm = new MashableInboxForm();
     $mashableInboxForm->attributes = $data;
     return $mashableInboxForm;
 }