/** * Returns active user session. * * @return coreUser */ public static function getUser() { if (self::$user === null) { self::$user = coreContext::getInstance()->getUser(); } return self::$user; }
public function getConfig() { coreToolkit::loadHelpers(array('Date', 'CJK')); $this->_selection = uiSelectionState::getSelection(manageActions::REMOVE_FLASHCARDS); return <<<EOD \t\t{ \t\t\tsettings: { \t\t\t\tprimaryKey: ['framenum'] \t\t\t}, \t\t\tcolumns: [ \t\t\t\t{ \t\t\t\t\tcaption: \t'Index', \t\t\t\t\twidth: \t\t5, \t\t\t\t\tcssClass:\t'center', \t\t\t\t\tcolData:\t'framenum' \t\t\t\t}, \t\t\t\t{ \t\t\t\t\tcaption: \t'Kanji', \t\t\t\t\twidth: \t\t7, \t\t\t\t\tcssClass:\t'kanji', \t\t\t\t\tcolData:\t'kanji', \t\t\t\t\tcolDisplay:\t'_kanji' \t\t\t\t}, \t\t\t\t{ \t\t\t\t\tcaption: \t'Keyword', \t\t\t\t\twidth: \t\t10, \t\t\t\t\tcssClass:\t'keyword', \t\t\t\t\tcolData:\t'keyword'/*, \t\t\t\t\tcolDisplay:\t'_keyword'*/ \t\t\t\t}, \t\t\t\t \t\t\t\t{ \t\t\t\t\tcaption: \t'Pass', \t\t\t\t\twidth: \t\t1, \t\t\t\t\tcssClass:\t'bold center', \t\t\t\t\tcolData:\t'successcount' \t\t\t\t}, \t\t\t\t{ \t\t\t\t\tcaption: \t'Fail', \t\t\t\t\twidth: \t\t1, \t\t\t\t\tcssClass:\t'center red', \t\t\t\t\tcolData:\t'failurecount', \t\t\t\t\tcolDisplay: '_failurecount' \t\t\t\t}, \t\t\t\t{ \t\t\t\t\tcaption: \t'Box', \t\t\t\t\twidth: \t\t8, \t\t\t\t\tcssClass:\t'bold center', \t\t\t\t\tcolData:\t'leitnerbox' \t\t\t\t}, \t\t\t\t{ \t\t\t\t\tcaption: \t'Last Review', \t\t\t\t\twidth: \t\t15, \t\t\t\t\tcssClass:\t'center', \t\t\t\t\tcolData:\t'ts_lastreview', \t\t\t\t\tcolDisplay:\t'_lastreview' \t\t\t\t}, \t\t\t\t{ \t\t\t\t\tcaption: \t'<input type="checkbox" name="chkAll" value="all" class="chkAll" />', \t\t\t\t\twidth: \t\t1, \t\t\t\t\tcssClass:\t'center', \t\t\t\t\tcolDisplay:\t'_checkbox' \t\t\t\t} \t\t\t] \t\t} EOD; }
public function getConfig() { coreToolkit::loadHelpers(array('Date', 'CJK')); $this->_selection = uiSelectionState::getSelection(manageActions::REMOVE_FLASHCARDS); return <<<EOD { settings: { primaryKey: ['framenum'] }, columns: [ { caption: 'Index', width: 5, cssClass: 'center', colData: 'framenum' }, { caption: 'Kanji', width: 7, cssClass: 'kanji', colData: 'kanji', colDisplay: '_kanji' }, { caption: 'Keyword', width: 10, cssClass: 'keyword', colData: 'keyword'/*, colDisplay: '_keyword'*/ }, { caption: 'Pass', width: 1, cssClass: 'bold center', colData: 'successcount' }, { caption: 'Fail', width: 1, cssClass: 'center red', colData: 'failurecount', colDisplay: '_failurecount' }, { caption: 'Box', width: 8, cssClass: 'bold center', colData: 'leitnerbox' }, { caption: 'Last Review', width: 15, cssClass: 'center', colData: 'ts_lastreview', colDisplay: '_lastreview' }, { caption: '<input type="checkbox" name="chkAll" value="all" class="chkAll" />', width: 1, cssClass: 'center', colDisplay: '_checkbox' } ] } EOD; }
public function executeRemoveListProcess($request) { // Confirm > cancel > go back and keep the current selection $this->forwardIf($request->hasParameter('cancel'), 'manage', 'removelist'); // Process > continue > reset form $this->forwardIf($request->hasParameter('reset'), 'manage', 'removelist'); // delete selected flashcards $selectedCards = uiSelectionState::getSelection(self::REMOVE_FLASHCARDS)->getAll(); $cards = rtkFlashcardDeck::deleteSelection($this->getUser()->getUserId(), $selectedCards); if (count($cards) != count($selectedCards)) { $request->setError('x', 'Oops! An error occured while deleting flashcards, not all flashcards were deleted.'); } return $this->renderPartial('RemoveListProcess', array('cards' => $cards, 'count' => count($cards))); }