public function filterDisplayData(uiSelectTableRow $row)
 {
     $rowData =& $row->getRowData();
     $rowData['_failurecount'] = $rowData['failurecount'] == 0 ? '' : $rowData['failurecount'];
     $rowData['_keyword'] = link_to_keyword($rowData['keyword'], $rowData['framenum']);
     $rowData['_lastreview'] = format_date((int) $rowData['ts_lastreview'], rtkLocale::DATE_SHORT);
 }
 public function filterDisplayData(uiSelectTableRow $row)
 {
     $rowData =& $row->getRowData();
     // needs MemberHelper in the view template
     $rowData['_username'] = link_to_member($rowData['username']);
     $rowData['_lastreview'] = format_date((int) $rowData['ts_lastreview'], rtkLocale::DATE_SHORT);
     return $rowData;
 }
Exemple #3
0
    /**
     * keys in data correspond to columns.bind
     *
     * @param $data Object
     */
    private function getTableRow(uiSelectTableRow $oRow, $bTemplateRow)
    {
        $rowData = $oRow->getRowData();
        $rowHtml = '';
        // get unique row id to match with invalid row data
        if (!$bTemplateRow) {
            $row_id = $this->getRowId($rowData);
            // validation data
            $bad_row = isset($this->badRows[$row_id]) ? $this->badRows[$row_id] : false;
        } else {
            $bad_row = false;
        }
        if ($bTemplateRow) {
            $rowHtml = $rowHtml . <<<EOD
    <tr class="JsRowTemplate" style="display:none;">

EOD;
        } else {
            if (isset($this->newRows[$row_id])) {
                $newRowClass = self::JSNEWROW_CLASS;
                $rowHtml = $rowHtml . <<<EOD
    <tr class="{$newRowClass}">

EOD;
            } else {
                if ($bad_row) {
                    $oRow->addCssClass(array('validation-error'));
                }
                $options = array('id' => $this->getRowId($rowData), 'class' => implode(',', $oRow->getCssClass()));
                $rowHtml = $rowHtml . tag('tr', $options, true);
            }
        }
        // row selection column
        if ($this->settings['editable'] && $this->settings['rowselection']) {
            $rowHtml = $rowHtml . <<<EOD
      <td><input type="checkbox" class="JsSelRow" />
        <input type="hidden" class="JsRowId" name="rowId" value="new" />
      </td>

EOD;
        }
        foreach ($this->columns as $colDef) {
            $bUsePostData = !$bTemplateRow && ($bad_row !== false && $colDef->editable || isset($this->newRows[$row_id]));
            //if ($bad_row!==false) echo '@@@@'.print_r($bad_row, true);
            if ($bUsePostData) {
                // bad data, or valid data in a new row that could not be saved yet : use post data
                $cellData = $this->postRowData[$row_id][$colDef->colData];
            } elseif ($bTemplateRow) {
                // template row : use default value for editable columns, otherwise blank
                $cellData = $colDef->editable ? $colDef->default : '';
            } else {
                if (isset($colDef->colDisplay)) {
                    //
                    $cellData = $rowData[$colDef->colDisplay];
                } else {
                    // raw data
                    $cellData = $rowData[$colDef->colData];
                }
            }
            $bValidationError = !$bTemplateRow && ($bad_row !== false && isset($bad_row[$colDef->colData]));
            $rowHtml = $rowHtml . $this->getTableCell($colDef, $cellData, $bValidationError);
        }
        // edit icon column
        if ($this->settings['editable'] && $this->settings['deleteicon']) {
            $rowHtml = $rowHtml . <<<EOD
      <td class="JsDelRow"><img src="/img/forms/ico-delete.gif" alt="Delete" title="Delete this item" /></td>

EOD;
        }
        $rowHtml = $rowHtml . <<<EOD
    </tr>

EOD;
        return $rowHtml;
    }
 public function filterDisplayData(uiSelectTableRow $row)
 {
     $rowData =& $row->getRowData();
     $rowData['_failurecount'] = $rowData['failurecount'] == 0 ? '' : $rowData['failurecount'];
     $rowData['_kanji'] = cjk_lang_ja($rowData['kanji']);
     //  $rowData['_keyword'] = link_to_keyword($rowData['keyword'], $rowData['framenum']);
     $tsLastReview = (int) $rowData['tsLastReview'];
     $rowData['_lastreview'] = $tsLastReview ? format_date($tsLastReview, rtkLocale::DATE_SHORT) : '-';
     $id = $rowData['framenum'];
     $rowData['_checkbox'] = $this->_selection->getInputTag('rf', $id) . $this->_selection->getCheckboxTag('rf', $id);
     if ($this->_selection->getState($id)) {
         $row->addCssClass(array('selected'));
     }
 }
 public function filterDisplayData(uiSelectTableRow $row)
 {
     $rowData =& $row->getRowData();
     $rowData['failurecount'] = $rowData['failurecount'] != 0 ? $rowData['failurecount'] : '';
     $rowData['_kanji'] = cjk_lang_ja($rowData['kanji']);
     $rowData['keyword'] = link_to_keyword($rowData['keyword'], $rowData['framenum']);
 }
Exemple #6
0
 public function filterDisplayData(uiSelectTableRow $row)
 {
     $rowData =& $row->getRowData();
     if ($rowData['failurecount'] == 0) {
         $rowData['failurecount'] = '';
     }
     $rowData['_kanji'] = cjk_lang_ja($rowData['kanji']);
     $rowData['_keyword'] = link_to_keyword($rowData['keyword'], $rowData['framenum']);
     $lastReviewTS = (int) $rowData['ts_lastreview'];
     $rowData['_lastreview'] = $lastReviewTS ? format_date($lastReviewTS, rtkLocale::DATE_SHORT) : '-';
     return $rowData;
 }