public static function includeText($name) { $value = StaticField::getStaticFieldValueByName($name); if (swValidate('edit')) { echo "<a target='_top' class='edit' href='swcms/editstatic.php?name={$name}' class='edit'></a>"; } echo displayValue($value); }
<a href="index.php?logoff=1"></a> </div> </div> <ul> <li><a href="view.php">view</a></li> <li><a href="edit.php" class='selected'>edit</a></li> </ul> </div> <div class="hline"></div> <div class="admin-content"><?php if ($name) { ?> <div class="admin-nav"><?php echo "<H2>Edit field: <strong>{$name}</strong></H2>"; $records = StaticField::getAllStaticFieldsByName($name); if ($records) { echo "<h3>history:</h3>\n<table>\n"; $firsttime = true; foreach ($records as $staticField) { echo "<tr><td class='label'>\n<a href='" . $_SERVER['PHP_SELF'] . "?name={$name}&init=" . $staticField[0] . "'>" . $staticField[3] . "</a></td>\n"; if ($firsttime) { $firsttime = false; echo "<td> </td>"; } else { echo "<td><a class='delete' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&delete=" . $staticField[0] . "'></a></td>"; } echo "</tr>\n"; } echo "</table>\n"; }
<section id='content'> <article> <h2><?php StaticField::includeText('content-title'); ?> </h2> <ul> <?php StructuredField::printField('listOfContents', "<li>\n@@1\n</li>\n"); ?> </ul> </article> </section> <footer> <?php StaticField::includeText('listOfPictures'); ?> <ul> <?php StructuredField::printField('listOfPictures', "<li>\n<img src='swcms/assets/@@a1' alt='@@t1'></img>\n</li>\n"); ?> </ul> </footer> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript">
$staticFields = StaticField::getAllStaticFieldsByName($name); if (!$staticFields) { $result = "no record for the name={$name}"; } else { foreach ($staticFields as $sf) { $sfList[] = implode(",", $sf); } $result = "getAllStaticFieldsByName result:\n" . implode("<br/>", $sfList); } break; case 'createStaticField': StaticField::createStaticField($name, $value); $result = "static field created: name={$name}, value={$value}"; break; case 'deleteStaticField': if (StaticField::deleteStaticField($id)) { $result = "static field deleted: id={$id}"; } else { $result = "cannot delete field with id={$id} because it is the current static field for the name {$name}"; } break; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>simple CMS - unit static field test</title> <link rel="shortcut icon" href="images/favicon.ico" />
public function __construct($label, $attr) { $this->popAttr('text', $attr, $text); parent::__construct($text, $label, $attr); }