コード例 #1
0
 private function setNearbySearch()
 {
     if ($this->value === null) {
         return null;
     }
     if (isset($this->requestOptions['nearbySearchForType']) && is_array($this->requestOptions['nearbySearchForType'])) {
         $this->nearbySearch = in_array($this->value->getTypeID(), $this->requestOptions['nearbySearchForType']);
     }
 }
コード例 #2
0
 private function addExternalHelpLinks()
 {
     if ($this->getRequest()->getVal('printable') === 'yes') {
         return null;
     }
     // FIXME with SMW 3.0, allow to be used with MW 1.25-
     if (!method_exists($this, 'addHelpLink')) {
         return null;
     }
     if ($this->subjectDV->isValid()) {
         $link = SpecialPage::getTitleFor('ExportRDF', $this->subjectDV->getTitle()->getPrefixedText());
         $this->getOutput()->setIndicators(array(Html::rawElement('div', array('class' => 'mw-indicator smw-page-indicator-rdflink'), Html::rawElement('a', array('href' => $link->getLocalUrl('syntax=rdf')), 'RDF'))));
     }
     $this->addHelpLink(wfMessage('smw-specials-browse-helplink')->escaped(), true);
 }
コード例 #3
0
 /**
  * A utility method for adding single-value data to a table
  *
  * @param string $table_name       table name
  * @param DataValue $value_object  instance of DataValue
  * @param bool $return_pk          default false, return the inserted pk value?
  * @return bool                    false if failure. on success, true or inserted pk based on $return_pk
  */
 public function doSimpleInsert($table_name, DataValue $value_object, $return_pk = false)
 {
     $properties = array();
     foreach ($value_object->properties() as $key => $value) {
         if (!is_int($value) && $value == "") {
             unset($value_object->{$key});
         } else {
             $properties[":{$key}"] = $value;
         }
     }
     $fields = implode(",", array_keys($value_object->properties()));
     $values = implode(",", array_keys($properties));
     $sql = "INSERT INTO {$table_name} ( {$fields} ) VALUES ( {$values} )";
     return $this->insert($sql, $properties, $return_pk);
 }