예제 #1
0
 public function render()
 {
     $appCtxt = $this->getApplicationContext();
     $personObjid = $appCtxt->getCurrentUserObjid();
     $str = '<div id="' . self::DIV_CARD . '">';
     if (isset($this->tableStyle)) {
         $str .= '<table';
         foreach ($this->tableStyle as $att => $val) {
             $str .= ' ' . $att . '="' . $val . '" ';
         }
         // foreach
         $str .= '>';
     } else {
         $str .= OpfHelperHtmlSite::tableHeaderPadded('100%');
     }
     if (!isset($this->dataList)) {
         $this->loadData();
     }
     // if
     $tdWidth = null;
     if ($this->maxPerRow > 1) {
         $tdWidth = 100 / $this->maxPerRow;
     }
     // if
     $columnIndex = 0;
     $rowIndex = 0;
     $str .= '<tr>';
     if (!is_null($this->dataList)) {
         foreach ($this->dataList as $data) {
             /* start new row if reached the max per row */
             if ($columnIndex >= $this->maxPerRow) {
                 $str .= '</tr><tr>';
                 $columnIndex = 0;
                 $rowIndex++;
             }
             // if
             $img = $this->renderCardImage($data[TableCard::FIELD_PICTURE_URL]);
             $str .= '<td vAlign="top" align="center" class="' . self::CLASS_CARD_LIST . '"';
             if (!is_null($tdWidth)) {
                 $str .= ' width="' . $tdWidth . '%"';
             }
             // if
             $str .= '>' . $img . $this->renderCardDetails($data);
             $objid = $data[TableCard::FIELD_OBJID];
             $actionStr = $this->renderCardButtons($personObjid, $objid, $data);
             if (!is_null($actionStr)) {
                 $str .= '<br>' . $actionStr;
             }
             // if
             $str .= '</td>' . $this->renderPossessionDetails($data);
             $columnIndex += 1;
         }
         // foreach
     }
     // if
     $str .= '</tr></table></div>';
     return $str;
 }