本文整理汇总了PHP中Label类的典型用法代码示例。如果您正苦于以下问题:PHP Label类的具体用法?PHP Label怎么用?PHP Label使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
/**
* Draw HTML output
*/
function draw()
{
global $c, $sid;
echo '<td colspan="' . $this->cells . '"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
$widget = new Cell("clc", "", 1, $this->width, 40);
$widget->draw();
echo "</tr><tr>\n";
$widget = new Label("lbl", $this->headline, "headbox", 1);
$widget->draw();
echo "</tr><tr>\n";
$widget = new FormImage($c["docroot"] . "modules/stats/widgets/statsimage.php?sid={$sid}&diagram=" . $this->diagramType . "&width=" . $this->width . "&height=" . $this->height . "&spid=" . $this->spid, $this->width, $this->height, 1);
$widget->draw();
// Draw Legend...
echo "</tr><tr>\n";
$widget = new Cell("clc", "", 1, $this->width, 10);
$widget->draw();
$colors[0] = __RED;
$colors[1] = __BLUE;
$colors[2] = __YELLOW;
$colors[3] = __GREEN;
for ($i = 0; $i < count($this->legend); $i++) {
echo "</tr><tr><td>";
echo '<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr>';
echo '<td width="10">' . ($i + 1) . '.</td>';
echo '<td width="11">';
echo '<table width="11" height="11" border="0" cellspacing="0" cellpadding="0"><tr><td style="background-color:' . $colors[$i] . ';">' . drawSpacer(11, 11) . '</td></tr></table>';
echo '</td>';
echo '<td>' . $this->legend[$i] . '</td>';
echo '</tr></table></td>';
}
echo "</tr></table></td>";
return $this->cells;
}
示例2: renderLabel
public function renderLabel($name, $attributes = array())
{
if ($widget = $this->widgets->get($name)) {
$label = new Label($widget->label);
return $label->render($attributes);
}
}
示例3: testRender
/**
* @covers Xoops\Form\Label::render
*/
public function testRender()
{
$value = $this->object->render();
$this->assertTrue(is_string($value));
$this->assertTrue(false !== strpos($value, '<span'));
$this->assertTrue(false !== strpos($value, 'id="name"'));
}
示例4: renderFormFieldContent
private function renderFormFieldContent($renderApi, $unit)
{
$this->formSubmit = new \FormSubmit();
$fieldId = 'field' . $unit->getId();
$properties = $unit->getFormValues();
$labelText = $properties["fieldLabel"];
$listType = $properties["listType"];
//select, checkbox, radio
$postRequest = $this->getPostValue($unit);
$choiceBox = new \ChoiceBox();
if ($listType === \ListType::RADIO || $listType === \ListType::CHECKBOX) {
$required = $renderApi->getFormValue($unit, 'enableRequired');
$formField = $choiceBox->getRadioCheckbox($renderApi, $unit, $fieldId, $postRequest, $required);
} elseif ($listType === \ListType::DROP_DOWN) {
$formField = $choiceBox->getSelectField($renderApi, $unit, $fieldId, $postRequest);
}
$label = new \Label();
$labelProperties = $label->getElementProperties();
$labelProperties->addAttribute("for", $fieldId);
$label->add(new \Span($labelText));
if ($formField) {
$elementProperties = $formField->getElementProperties();
$wrapper = new \Container();
$wrapper->add($label);
$wrapper->add($formField);
echo $wrapper->renderElement();
}
$renderApi->renderChildren($unit);
}
示例5: label
function label($text, $font)
{
$label = new Label($text, $font, NULL, 0);
$label->setBackgroundColor(new Color(255, 255, 255, 25));
$label->border->show();
$label->setPadding(1, 0, 0, 0);
return $label;
}
示例6: draw
/**
* Write HTML for the WUI-Object.
*
*/
function draw() {
$dr3 = new Label("lbl", $this->text, "headbox", $this->columns);
echo "<tr>";
$dr3->draw();
echo "</tr>";
return $this->columns;
}
示例7: actionManage
public function actionManage()
{
$model = new Label('search');
$model->unsetAttributes();
if (isset($_GET['Label'])) {
$model->attributes = $_GET['Label'];
}
$this->render('manage', array('model' => $model));
}
示例8: create
public function create()
{
$L = new Label();
if (!$L->find($this->label)) {
$L->label = $this->label;
$L->create();
}
return parent::create();
}
示例9: createFromXML
/**
* Convert the raw XML into an object
*
* @param \SimpleXMLElement $xml
* @return Label
*/
public static function createFromXML(\SimpleXMLElement $xml)
{
$label = new Label();
$attributes = $xml->attributes();
if (isset($attributes['cdbid'])) {
$label->setCdbid($attributes['cdbid']);
}
$label->setValue((string) $xml);
return $label;
}
示例10: AddMeasurement
public function AddMeasurement($measurement)
{
$measurement->TestId = $this->Id;
$this->Measurements[] = $measurement;
if ($measurement->Name == 'Label') {
$label = new Label();
$label->SetText($measurement->Value);
$this->AddLabel($label);
}
}
示例11: updateset
function updateset($lid)
{
$clang = Yii::app()->lang;
// Get added and deleted languagesid arrays
if ($_POST['languageids']) {
$postlanguageids = sanitize_languagecodeS($_POST['languageids']);
}
if ($_POST['label_name']) {
$postlabel_name = sanitize_labelname($_POST['label_name']);
}
$newlanidarray = explode(" ", trim($postlanguageids));
$oldlangidsarray = array();
$labelset = Labelsets::model()->findByAttributes(array('lid' => $lid));
$oldlangidsarray = explode(' ', $labelset->languages);
$addlangidsarray = array_diff($newlanidarray, $oldlangidsarray);
$dellangidsarray = array_diff($oldlangidsarray, $newlanidarray);
// If new languages are added, create labels' codes and sortorder for the new languages
$result = Label::model()->findAllByAttributes(array('lid' => $lid), array('order' => 'code, sortorder, assessment_value'));
if ($result) {
foreach ($result as $row) {
$oldcodesarray[$row['code']] = array('sortorder' => $row['sortorder'], 'assessment_value' => $row['assessment_value']);
}
}
if (isset($oldcodesarray) && count($oldcodesarray) > 0) {
foreach ($addlangidsarray as $addedlangid) {
foreach ($oldcodesarray as $oldcode => $olddata) {
$sqlvalues[] = array('lid' => $lid, 'code' => $oldcode, 'sortorder' => $olddata['sortorder'], 'language' => $addedlangid, 'assessment_value' => $olddata['assessment_value']);
}
}
}
if (isset($sqlvalues)) {
foreach ($sqlvalues as $sqlvalue) {
$label = new Label();
foreach ($sqlvalue as $name => $value) {
$label->setAttribute($name, $value);
}
$label->save();
}
}
// If languages are removed, delete labels for these languages
$criteria = new CDbCriteria();
$criteria->addColumnCondition(array('lid' => $lid));
$langcriteria = new CDbCriteria();
foreach ($dellangidsarray as $dellangid) {
$langcriteria->addColumnCondition(array('language' => $dellangid), 'OR');
}
$criteria->mergeWith($langcriteria);
if (!empty($dellangidsarray)) {
$result = Label::model()->deleteAll($criteria);
}
// Update the label set itself
$labelset->label_name = $postlabel_name;
$labelset->languages = $postlanguageids;
$labelset->save();
}
示例12: onClickUnblock
public function onClickUnblock($sender)
{
$this->captcha_error_obj->emptyObject();
if ($this->captcha->check()) {
WspBannedVisitors::resetBannedIP($this->getRemoteIP());
$this->refreshPage();
} else {
$error = new Label(__(ERROR_CAPTCHA));
$error->setColor("red");
$this->captcha_error_obj->add($error);
}
}
示例13: updateActual
public function updateActual($aData)
{
if (isset($aData['id'])) {
$this->id = $aData['id'];
$this->edited = new Doctrine_Expression('NOW()');
} else {
$this->created = new Doctrine_Expression('NOW()');
$this->edited = new Doctrine_Expression('NOW()');
}
$aTags = Tag::checkTags(Tag::makeTags($aData['tags']));
$this->title = $aData['title'];
$this->shortcontent = trim(stripslashes($aData['shortcontent']));
$this->fullcontent = trim(stripslashes($aData['fullcontent']));
$this->tags = $aData['tags'];
$this->active = $aData['active'];
$this->link = Webbers_Normalize::Link($aData['title']);
$this->AktualsTags->delete();
$this->AktualsLabels->delete();
$this->save();
if (sizeof($aTags) > 0) {
foreach ($aTags as $tag) {
$aktualTags = new AktualsTag();
$aktualTags->Aktuals_id = $this->id;
$aktualTags->Tags_id = $tag->id;
$aktualTags->save();
}
}
$labels = array();
if (isset($aData['newlabel']) and $aData['newlabel'] != '') {
$newLabel = Webbers_Normalize::Name($aData['newlabel']);
$label = Label::getLabel($newLabel);
if ($label != false) {
$labelID = $label->id;
} else {
$label = new Label();
$label->Gname = $newLabel;
$label->save();
$labelID = $label->getIncremented();
}
$labels = array($labelID);
}
if (isset($aData['labels']) and sizeof($aData['labels']) > 0) {
$labels = array_unique(array_merge($aData['labels'], $labels));
foreach ($labels as $lab) {
$al = new AktualsLabel();
$al->Labels_id = $lab;
$al->Aktuals_id = $this->id;
$al->save();
}
}
return $this->id;
}
示例14: draw
/**
* Draw HTML output
*/
function draw()
{
global $c, $sid;
echo '<td colspan="' . $this->cells . '"><table width="600" border="0" cellpadding="0" cellspacing="0"><tr>';
$widget = new Cell("clc", "", 2, $this->width, 20);
$widget->draw();
echo "</tr><tr>\n";
$widget = new Label("lbl", '<br><h3>' . $this->headline . '</h3>', '', 2);
$widget->draw();
echo "</tr>\n";
echo $this->container;
echo "</tr></table></td>";
return $this->cells;
}
示例15: draw
/**
* Draw HTML output
*/
function draw()
{
global $c, $sid;
echo '<td colspan="' . $this->cells . '" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
$widget = new Cell("clc", "", 4, $this->width, 20);
$widget->draw();
echo "</tr><tr>\n";
$widget = new Label("lbl", $this->headline, "stats_headline", 4);
$widget->draw();
echo "</tr>\n";
echo $this->container;
echo "</tr></table></td>";
return $this->cells;
}