示例#1
0
 /**
  *
  *
  */
 public function ExtraRow($title, $types)
 {
     global $langmessage;
     $file = $this->ExtraExists($title);
     $file_draft = dirname($file) . '/draft.php';
     $sections = \gp\tool\Output::ExtraContent($title);
     $section = $sections[0];
     echo '<tr><td style="white-space:nowrap">';
     echo str_replace('_', ' ', $title);
     echo '</td><td>';
     $type = $section['type'];
     if (isset($types[$type]) && isset($types[$type]['label'])) {
         $type = $types[$type]['label'];
     }
     echo $type;
     echo '</td><td>"<span class="admin_note">';
     $content = strip_tags($section['content']);
     echo substr($content, 0, 50);
     echo '</span>..."</td><td style="white-space:nowrap">';
     //preview
     echo \gp\tool::Link('Admin/Extra', $langmessage['preview'], 'cmd=PreviewText&file=' . rawurlencode($title));
     echo ' &nbsp; ';
     //publish
     if (file_exists($file_draft)) {
         echo \gp\tool::Link('Admin/Extra', $langmessage['Publish Draft'], 'cmd=PublishDraft&file=' . rawurlencode($title), array('data-cmd' => 'creq'));
     } else {
         echo '<span class="text-muted">' . $langmessage['Publish Draft'] . '</span>';
     }
     echo ' &nbsp; ';
     //edit
     if ($section['type'] == 'text') {
         echo \gp\tool::Link('Admin/Extra', $langmessage['edit'], 'cmd=EditExtra&file=' . rawurlencode($title));
     } else {
         echo '<span class="text-muted">' . $langmessage['edit'] . '</span>';
     }
     echo ' &nbsp; ';
     $title = sprintf($langmessage['generic_delete_confirm'], htmlspecialchars($title));
     echo \gp\tool::Link('Admin/Extra', $langmessage['delete'], 'cmd=DeleteArea&file=' . rawurlencode($title), array('data-cmd' => 'postlink', 'title' => $title, 'class' => 'gpconfirm'));
     echo '</td></tr>';
 }