Example #1
0
 public function function_call($field, $object, $data)
 {
     $classname = ucfirst($object['contentname']);
     $function_name = strval($field['name']);
     if (class_exists($classname) && method_exists($classname, $function_name)) {
         View_Loader::get_instance()->set_path(CONTENTPATH . $object['contentname']);
         $result = call_user_func_array($classname . '::' . $function_name, array($object, $data));
         if ($result) {
             echo view("head", array("pages" => FW4_Admin::get_pages(), "title" => strval($field), "user" => FW4_User::get_user(), "site" => current_site()));
             echo '<h2>' . strval($field) . '</h2>';
             echo '<div class="input">' . $result . '</div>';
             echo '<div class="controls">';
             echo '<a class="button save" href="' . preg_replace('/[^\\/]+\\/[^\\/]+\\/?$/', '', $_SERVER['REQUEST_URI']) . '">' . l(array('nl' => 'Terug', 'fr' => 'Retour', 'en' => 'Back')) . '</a>';
             if (isset($field['allow_print'])) {
                 echo '<a class="button right" href="#" onclick="window.print();return false;">' . l(array('nl' => 'Afdrukken', 'fr' => 'Imprimer', 'en' => 'Print', 'de' => 'Drucken')) . '</a>';
             }
             echo '</div>';
             echo view("foot", array('scripts' => array()));
             exit;
         }
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
Example #2
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);
     }
 }