Example #1
0
 static function renderCheckBox($name, $rows, $id = null, $checked = null, $javascript = null, $image = false, $imageWidth = null, $imageHeight = null, $imageCrop = null, $prefix = '@[{(&*_')
 {
     $html = '<table cellspacing="0" cellpadding="0">';
     $str = '';
     $id = $id ? ' id="' . $id . '"' : '';
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             if ($checked) {
                 if (count($checked) > 0) {
                     foreach ($checked as $item) {
                         if ($item->fieldsid == $row->fieldsid && $item->value == $row->name) {
                             $_checked = ' checked="checked"';
                             break;
                         } else {
                             $_checked = '';
                         }
                     }
                 }
             } else {
                 $_checked = '';
             }
             //                $checked    = ($checked==$row -> value)?' checked = "'.$checked.'"':'';
             $str .= '<tr>';
             $str .= '<td>';
             if ($image != false) {
                 if (isset($row->image) && !empty($row->image)) {
                     $str .= ArticleHTML::renderImg(JURI::root() . $row->image, $imageWidth, $imageHeight, $imageCrop);
                 }
             }
             $str .= '</td>';
             $str .= '<td>';
             $str .= '<input type="checkbox" name="' . $name . '"' . ' value="' . addslashes($row->name) . $prefix . $row->value . '"' . $id . $_checked . $javascript . '/>';
             $str .= '&nbsp;' . $row->name . '</td>';
             $str .= '</tr>';
         }
     }
     $html .= $str . '</table>';
     return $html;
 }