/** * 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; }
public function renderLabel($name, $attributes = array()) { if ($widget = $this->widgets->get($name)) { $label = new Label($widget->label); return $label->render($attributes); } }
/** * @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"')); }
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); }
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; }
/** * 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; }
public function actionManage() { $model = new Label('search'); $model->unsetAttributes(); if (isset($_GET['Label'])) { $model->attributes = $_GET['Label']; } $this->render('manage', array('model' => $model)); }
public function create() { $L = new Label(); if (!$L->find($this->label)) { $L->label = $this->label; $L->create(); } return parent::create(); }
/** * 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; }
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); } }
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(); }
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); } }
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; }
/** * 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; }
/** * 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; }
private function renderFormFieldContent($renderApi, $unit) { $this->formSubmit = new \FormSubmit(); $fieldId = 'field' . $unit->getId(); $properties = $unit->getFormValues(); $labelText = $properties["fieldLabel"]; $fieldType = $properties["textType"]; //input,list,textarea $postRequest = $this->getPostValue($unit); if ($properties['type'] === \InputType::STRING && $fieldType !== FieldType::TEXTAREA || $properties['type'] === \InputType::EMAIL || $properties['type'] === \InputType::NUMERIC) { $formField = new \TextField(); $elementProperties = $formField->getElementProperties(); $elementProperties->setId($fieldId); $elementProperties->addAttribute("name", $fieldId); $elementProperties->addAttribute('value', $postRequest); if (isset($properties['type'])) { if ($properties['type'] === \InputType::EMAIL) { $elementProperties->addAttribute("type", \InputType::EMAIL); } if ($properties['type'] === \InputType::NUMERIC) { $elementProperties->addAttribute("type", \InputType::NUMERIC); } } } elseif ($fieldType === FieldType::TEXTAREA) { $formField = new \TextareaField(); $elementProperties = $formField->getElementProperties(); $elementProperties->setId($fieldId); $elementProperties->addAttribute("name", $fieldId); $formField->setContent($postRequest); } $label = new \Label(); $labelProperties = $label->getElementProperties(); $labelProperties->addAttribute("for", $fieldId); $label->add(new \Span($labelText)); if ($formField) { $wrapper = new \Container(); $wrapper->add($label); $wrapper->add($formField); $elementProperties = $formField->getElementProperties(); if ($this->formSubmit->isValid($renderApi, $unit) && !$this->isValidValue($unit, $postRequest)) { $elementProperties->addClass('vf__error'); $wrapper->add($this->getErrorMessage($unit, $postRequest)); } $this->setRequiredField($renderApi, $unit, $elementProperties); $this->setPlaceholderText($renderApi, $unit, $elementProperties); echo $wrapper->renderElement(); } $renderApi->renderChildren($unit); }
public function testRemoveLabels_DelegatesToClient() { $expected = $this->node; $expected->setId(123); $matched = false; $label = new Label($this->client, 'FOOBAR'); $this->client->expects($this->once())->method('removeLabels')->will($this->returnCallback(function (Node $actual, $labels) use($expected, $label, &$matched) { $matched = $expected->getId() == $actual->getId(); $matched = $matched && $label->getName() == $labels[0]->getName(); return array($label); })); $labels = $this->node->removeLabels(array($label)); $this->assertEquals(1, count($labels)); $this->assertSame($label, $labels[0]); }
public function render(array $item) { // When no items are set, we act as if this is a normal label. // @todo Decide if we should throw an exception instead? if (empty($item['child_items'])) { return parent::render($item); } $options = $this->getOptions($item); $label = $this->getLabel($options); $title = $this->getTitle($options, $label); $id = uniqid(); $boxId = 'dropdown-box-' . $id . '-dropdown'; $anchorId = 'menu-option-' . $id; $anchorAttr = []; $anchorAttr['href'] = ''; $anchorAttr['id'] = $anchorId; $anchorAttr['class'] = 'zui-button-dropdown'; $anchorAttr['aria-haspopup'] = 'true'; $anchorAttr['aria-controls'] = $boxId; $anchorAttr['aria-expanded'] = 'false'; $anchorAttr['title'] = $title; $result = '<li role="presentation">'; $result .= sprintf('<a %s>%s</a>', $this->createAttribs($anchorAttr), $label); $result .= $this->renderBox($anchorId, $boxId, $item); return $result . '</li>'; }
public function main($build_type, $label) { $label = Label::where('label_name', '=', $label)->firstOrFail(); $versions = $label->versions(); $this->setTitle("Versions with label - {$label->label_name}"); $this->layout->versions = $versions->get(); }
protected function drawLabels($drawer) { if($this->labelNumber !== NULL) { list($min, $max) = $this->range; $number = $this->labelNumber - 1; if($number < 1) { return; } $function = $this->rangeCallback['toValue']; $labels = array(); for($i = 0; $i <= $number; $i++) { $labels[] = $function($i / $number, $min, $max); } $this->label->set($labels); } $labels = $this->label->count(); for($i = 0; $i < $labels; $i++) { $p = $this->getPointFromValue($this->label->get($i)); $this->label->draw($drawer, $p, $i); } }
public function run() { $criteria = new CdbCriteria(); $criteria->limit = $this->data('limit'); $criteria->offset = $this->data('offset'); $criteria->condition = "post_status='publish' AND (post_modified <= '" . date('Y-m-d H:i:s') . "' AND post_modified >= '" . $this->data('time') . "')"; $criteria->order = 'post_hits DESC'; if ($this->data('autoByTerm')) { if (isset($_GET['id'])) { $category = Category::model()->findByPK((int) $_GET['id']); $label = Label::model()->findByPK((int) $_GET['id']); $topic = Topic::model()->findByPK((int) $_GET['id']); $tag = Tag::model()->findByPK((int) $_GET['id']); if ($category != null) { $criteria = $this->getCriteriaTerm('categories', $criteria); } elseif ($label != null) { $criteria = $this->getCriteriaTerm('labels', $criteria); } elseif ($topic != null) { $criteria = $this->getCriteriaTerm('topics', $criteria); } elseif ($tag != null) { $criteria = $this->getCriteriaTerm('tags', $criteria); } } } $model = Post::model()->findAll($criteria); if ($model != null) { $this->layout($model); } }
private function loadModel($param = '') { $status = 'publish'; $criteria = new CDbCriteria(); $criteria->condition = "parent=0"; $this->_labels = Label::model()->findAll($criteria); $this->_category = Category::model()->findAll($criteria); $criteria->condition = "post_status =:status"; $criteria->params = array(':status' => $status); if ($param == 'post') { $criteria->order = "ID desc"; } elseif ($param == 'populer') { $criteria->order = "post_hits desc"; } else { $criteria->order = "ID desc"; } foreach ($this->_labels as $label) { if ($label->slug == $param) { $criteria->with = array("labels"); $criteria->together = true; $criteria->condition = "labels.slug='{$param}'"; $criteria->order = "ID desc"; } } foreach ($this->_category as $cat) { if ($cat->slug == $param) { $criteria->with = array("categories"); $criteria->together = true; $criteria->condition = "categories.slug='{$param}'"; $criteria->order = "ID desc"; } } $dataProvider = new CActiveDataProvider('Post', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10))); return $dataProvider; }
/** * Forgery constructor */ public function __forge() { $this->checkbox = Radio::forge(); $this->label = Label::forge()->removeClass('control-label'); $this->label->addContent($this->checkbox); $this->label->addClass('checkbox'); }
public function __construct($data = [], $connection = null) { $this->connection = $connection; foreach (['id', 'shipment_reference', 'tracking_url'] as $prop) { if (isset($data[$prop])) { $this->{$prop} = $data[$prop]; } } foreach (['sender', 'recipient'] as $prop) { $this->{$prop} = isset($data[$prop]) ? Address::import($data[$prop]) : null; } $this->product = isset($data['product']) ? Product::import($data['product']) : null; if (isset($data['parcels'])) { $this->parcels = []; foreach ($data['parcels'] as $parcel_data) { $this->parcels[] = Parcel::import($parcel_data); } } if (isset($data['labels'])) { $this->labels = []; foreach ($data['labels'] as $url) { $this->labels[] = Label::import($url, $connection); } } if (isset($data['order'])) { $this->order = Order::import($data['order'], $connection); } if (isset($data['allow'])) { $this->allow = $data['allow']; } }
public function getRadioCheckbox($renderApi, $unit, $fieldId, $postRequestValue = null, $required = false) { $formField = new \Fieldset(); $listOptions = $this->listOptions->getListOptions($renderApi, $unit); $inputName = strlen($renderApi->getFormValue($unit, 'inputName')) > 0 ? $renderApi->getFormValue($unit, 'inputName') . "[]" : $fieldId . "[]"; if ($listOptions->hasOptions()) { $optionCount = 0; $options = $listOptions->getOptions(); $optionsLength = count($options); foreach ($options as $option) { /* @var $option \Option */ $properties = $unit->getFormValues(); if ($properties["listType"] === \ListType::RADIO) { $choiceField = new \RadioButtonField(); } elseif ($properties["listType"] === \ListType::CHECKBOX) { $choiceField = new \CheckboxField(); } $optionId = $fieldId . '_' . $optionCount; $elementProperties = $choiceField->getElementProperties(); $elementProperties->addAttribute("value", $option->getValue()); $elementProperties->addAttribute("name", $inputName); $elementProperties->addAttribute("id", $optionId); // set required attribute for radio options or when there is only one checkbox // don't set for multiple checkboxes to match server-side validation logic if ($required && ($properties["listType"] === \ListType::RADIO || $optionsLength === 1)) { $elementProperties->addAttribute("required", null); } $request = new Request(); $request->isPostRequest(); if (!$request->isPostRequest() && $option->isChecked() || !is_null($postRequestValue) && in_array($option->getValue(), $postRequestValue)) { $elementProperties->addAttribute("checked", null); } $label = new \Label(); $label->add($choiceField); $label->add(new \Span($option->getName())); $labelProperties = $label->getElementProperties(); $labelProperties->addAttribute("for", $optionId); $formField->add($label); $optionCount++; } } if ($this->formSubmit->isValid($renderApi, $unit) && !$this->isValidValue($unit, $postRequestValue)) { $formField->add($this->getErrorMessage($unit, $postRequestValue)); $formField->getElementProperties()->addClass('vf__error'); } return $formField; }
function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing) { $max = $this->getRealYMax(); $min = $this->getRealYMin(); // Get start and stop values list($start, $stop) = $this->getLimit(); if ($this->lineMode === LINEPLOT_MIDDLE) { $inc = $this->xAxis->getDistance(0, 1) / 2; } else { $inc = 0; } // Build the polygon $polygon = new awPolygon(); for ($key = $start; $key <= $stop; $key++) { $value = $this->datay[$key]; if ($value !== NULL) { $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value)); $p = $p->move($inc, 0); $polygon->set($key, $p); } } // Draw backgrounds if (is_a($this->lineBackground, 'awColor') or is_a($this->lineBackground, 'awGradient')) { $backgroundPolygon = new awPolygon(); $p = $this->xAxisPoint($start); $p = $p->move($inc, 0); $backgroundPolygon->append($p); // Add others points foreach ($polygon->all() as $point) { $backgroundPolygon->append($point); } $p = $this->xAxisPoint($stop); $p = $p->move($inc, 0); $backgroundPolygon->append($p); // Draw polygon background $drawer->filledPolygon($this->lineBackground, $backgroundPolygon); } $this->drawArea($drawer, $polygon); // Draw line $prev = NULL; // Line color if ($this->lineHide === FALSE) { if ($this->lineColor === NULL) { $this->lineColor = new awColor(0, 0, 0); } foreach ($polygon->all() as $point) { if ($prev !== NULL) { $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness)); } $prev = $point; } $this->lineColor->free(); } // Draw marks and labels foreach ($polygon->all() as $key => $point) { $this->mark->draw($drawer, $point); $this->label->draw($drawer, $point, $key); } }
public static function INSERT() { $row = parent::INSERT(); $label = Label::INSERT(); $label->setText('Hyperlink'); $row->setLabel($label); return $row; }
private function loadModel($id, $slug) { $models = Label::model()->findByAttributes(array('term_id' => (int) $id, 'slug' => $slug)); if ($models === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $models; }
public function __construct($id = null, $name = null, $status = null, $LabelType = null) { parent::__construct(); $this->id = $id; $this->name = $name; $this->status = $status; $this->LabelType = $LabelType; }
/** * The HTML representation of this element wrapped in a label * * @return string */ public function toHTML() { if ($this->label) { return '<label ' . buildAttributes($this->label->attrs()) . '>' . DOKU_LF . '<span>' . hsc($this->label->val()) . '</span>' . DOKU_LF . $this->mainElementHTML() . DOKU_LF . '</label>'; } else { return $this->mainElementHTML(); } }