Пример #1
0
 public function function_comments($field, $object, $data, $id)
 {
     if ($row = where('id = %d', intval($id))->get_row($object['stack'] . '/' . $field['name'])) {
         $commentsfield = reset($field->xpath('object'));
         if (!$commentsfield) {
             error(404);
         }
         $commentsfield['stack'] = $object['stack'] . '/' . $field['name'] . '/' . $commentsfield['name'];
         $commentsquery = where($field['name'] . '_id', intval($id));
         $commentsamount = $commentsquery->count_rows($commentsfield['stack']);
         $commentsdata = $commentsquery->get($commentsfield['stack']);
         $segments = array_slice(func_get_args(), 4);
         if (count($segments)) {
             if (!FW4_Admin::handle_item($segments, $data)) {
                 error(404);
             }
         } else {
             echo view("head", array("pages" => FW4_Admin::get_pages(), "title" => isset($commentsfield['title']) ? $commentsfield['title'] : 'Comments', "user" => FW4_User::get_user(), "site" => current_site()));
             echo '<h2>' . (isset($commentsfield['title']) ? $commentsfield['title'] : 'Comments') . '</h2>';
             echo '<div class="input"><fieldset>';
             echo '<img src="' . $row->scale(100, 100) . '" class="thumbnail" style="display:inline-block;vertical-align:middle;margin-right:10px;"/><div style="display:inline-block;vertical-align:middle;">' . $row['orig_filename'] . '</div>';
             echo '</fieldset></div>';
             unset($commentsfield['title']);
             FW4_Admin::print_object_list($commentsfield, $commentsdata, $commentsamount, intval($id));
             echo '<div class="controls">';
             echo '<a class="button save" href="' . preg_replace('/[^\\/]+\\/[^\\/]+\\/[^\\/]+\\/?$/', '', $_SERVER['REQUEST_URI']) . '">' . l(array('nl' => 'Terug', 'fr' => 'Retour', 'en' => 'Back')) . '</a>';
             echo '</div>';
             echo view("foot", array('scripts' => array()));
         }
     } else {
         error(404);
     }
 }