function insertRecords($records, $name, $init, $type) { if ($records) { echo "<h3>{$type} labels:</h3>\n<table>\n"; $firsttime = true; $lastItem = count($records) - 1; $index = 0; foreach ($records as $record) { if ($record[0] == $init) { $selected = "class='selected'"; } else { $selected = ''; } echo "<tr><td class='label'>\n<a {$selected} href='" . $_SERVER['PHP_SELF'] . "?name={$name}&type={$type}&init=" . $record[0] . "'>" . displayValue($record[2]) . "</a></td>\n"; echo "<td><a class='delete' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&type={$type}&delete=" . $record[0] . "'></a></td>"; if ($firsttime || $index == $lastItem) { $firsttime = false; echo "<td> </td><td> </td>"; } else { echo "<td><a class='up' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&type={$type}&moveup=" . $index . "'></a></td>"; echo "<td><a class='down' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&type={$type}&movedown=" . $index . "'></a></td>"; } echo "</tr>\n"; $index++; } echo "</table>\n"; } echo "<br/>Create a new {$type} label: <a class='new' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&new=1&type={$type}'></a><br/><br/>\n"; }
public static function printField($name, $formattedString) { if (swValidate('edit')) { echo "<div style='position:absolute'><a target='_top' class='edit' href='swcms/editrecord.php?edittype=record&name={$name}' class='edit'></a></div>"; } $fieldList = StructuredField::getSortedRecords(StructuredUnit::getUnitId($name), true); $rank = 1; if ($fieldList) { foreach ($fieldList as $field) { $output = $formattedString; $output = str_replace("@@rank", $rank++, $output); $values = StructuredFieldValue::getValues($field[0]); $index = 1; if ($values) { foreach ($values as $value) { $output = str_replace("@@" . $index++, displayValue($value[3]), $output); } } $index = 1; $assets = StructuredFieldAsset::getAssets($field[0]); if ($assets) { foreach ($assets as $asset) { $output = str_replace("@@a" . $index, displayValue($asset[2]), $output); $output = str_replace("@@t" . $index, displayValue($asset[1]), $output); $index++; } } echo $output; } } }
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); }
switch (StructuredFieldValue::getType($textField[2])) { case 'text': echo "<input type='text' name='value" . $index++ . "' value='" . restoreValue($textField[3]) . "' width=40></input><br/>\n"; break; case 'textarea': echo "<textarea name='value" . $index++ . "' rows='15' cols='70'>" . restoreValue($textField[3]) . "</textarea>"; break; } } } // update assets $index = 0; if ($assetArray) { foreach ($assetArray as $asset) { echo "<h3>" . $asset[5] . "</h3>\n"; echo "enter the title here<br/><input type='text' name='asset{$index}' value='" . displayValue($asset[1]) . "' width=40></input><br/>\n"; echo "<input type='file' name='file{$index}'></input>"; if ($asset[2]) { echo " - (current uploaded file:" . $asset[2] . ")"; } echo "<br/>\n"; $index++; } } echo "<br/>\n"; if ($isAdmin) { if ($lock) { $lock = " CHECKED"; } echo "<INPUT TYPE=CHECKBOX NAME='lock' VALUE='1'{$lock}> Cannot be edited by non-admin users</INPUT>"; }
} ?> </div> <!-- end .input --> <div class="context">Your appointment date</div> <!-- end .context --> </div> <!-- end .row --> <div class="row"> <div class="label">Summary:</div> <!-- end .label --> <div class="input"> <textarea id="comment" name="app_summary" class="message"><?php displayValue('app_summary'); ?> </textarea> </div> <!-- end .input --> <div class="context"></div> <!-- end .context --> </div> <!-- end .row --> <div class="submit"><input type="submit" id="submit" class="Submit" name="add_app" value="<?php echo isset($app) ? 'Edit' : 'Add appointment'; ?> "/></div>
} printf("\n"); } printf("\n"); } // Display stats infos if (count($stats)) { printf("[47;30m%-122s[0m\n", "Stats for the last " . count($commits) . " commits (within the last {$iteration} days)"); printf("%-20s %-20s %-20s %s\n", "", "Commits", "Files", ""); foreach ($stats as $committer => $stat) { displayValue(limitText($stat['name'], 20), 21); displayValue($stat['totalCommits'], 8, "0;33"); displayValue($stat['percentCommits'] . '%', 13); displayValue($stat['totalFiles'], 8, "0;33"); displayValue($stat['percentFiles'] . '%', 13); displayValue(limitText($committer, 39), 40); printf("\n"); } printf("\n"); } //---------- // Functions //---------- function getCurrentBranch($gitDir) { $cmd = sprintf("git --git-dir='%s/.git' branch | grep \\* | sed 's/* //g'", $gitDir); exec($cmd, $branch); if (count($branch) == 0) { exit('No branch selected in ' . $gitDir); } return $branch[0];