本文整理汇总了PHP中Fields类的典型用法代码示例。如果您正苦于以下问题:PHP Fields类的具体用法?PHP Fields怎么用?PHP Fields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fields类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create
function create($aData)
{
if (!isset($aData['FLD_UID'])) {
$aData['FLD_UID'] = G::generateUniqueID();
} else {
if ($aData['FLD_UID'] == '') {
$aData['FLD_UID'] = G::generateUniqueID();
}
}
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
try {
$oFields = new Fields();
$oFields->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oFields->validate()) {
$oConnection->begin();
$iResult = $oFields->save();
$oConnection->commit();
return $aData['FLD_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oFields->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw new Exception('The registry cannot be created!<br />' . $sMessage);
}
} catch (Exception $oError) {
$oConnection->rollback();
throw $oError;
}
}
开发者ID:nshong,项目名称:processmaker,代码行数:31,代码来源:Fields.php
示例2: testSetFields
public function testSetFields()
{
$this->fields->setFields(array('alphaField' => 'foo', 'valueField' => 'bar'));
$this->assertEquals('foo', $this->fields->getAlphaField());
$this->assertEquals('bar', $this->fields->getValueField());
$this->assertNull($this->fields->getColorField());
}
开发者ID:neeckeloo,项目名称:AmChartsPHP,代码行数:7,代码来源:FieldsTest.php
示例3: displayWebFormFields
/**
* displayWebForm
* Display the webform within OFuz.net so we can use all the ofuz / radria field type
*/
function displayWebFormFields()
{
$out = '<table>';
$do_webform_userfields = new WebFormUserField();
$do_webform_userfields->query("SELECT wfu.name, wfu.label, wfu.required, wfu.size, wff.field_type \n\t\t FROM webformfields as wff, webformuserfield as wfu \n\t\t\t\t\t\t\t\t\t\t WHERE wff.name=wfu.name\n\t\t\t\t\t\t\t\t\t\t AND wfu.idwebformuser = " . $this->getPrimaryKeyValue() . "\n\t\t\t\t\t\t\t\t\t\t ORDER BY wff.display_order");
$field_format = new Fields();
while ($do_webform_userfields->next()) {
$field_format->addField($do_webform_userfields->name, $do_webform_userfields->field_type);
if ($do_webform_userfields->size) {
if ($do_webform_userfields->field_type == 'FieldTypeText') {
$field_format->fields[$do_webform_userfields->name]->textarea = $do_webform_userfields->size;
} else {
$field_format->fields[$do_webform_userfields->name]->size = $do_webform_userfields->size;
}
}
}
//print_r($field_format);
$do_webform_userfields->first();
//$do_webform_userfields->newForm();
//$do_webform_userfields->setFields($field_format);
//$do_webform_userfields->setApplyFieldFormating(true);
while ($do_webform_userfields->next()) {
$out .= "\n" . '<tr><td class="webform_row_label">' . $do_webform_userfields->label . '</td><td class="webform_row_field">' . $field_format->applyRegToForm($do_webform_userfields->name, '') . '</td></tr>';
}
$out .= '</table>';
return $out;
}
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:WebFormUser.class.php
示例4: test_scenario1
public function test_scenario1()
{
$data = array(array('filename' => 'data/iris_missing.csv', 'params' => array("fields" => array("000000" => array("optype" => "numeric"))), 'missing_values' => array("000000" => 1)));
print "Successfully obtaining missing values counts\n";
foreach ($data as $item) {
print "I create a data source uploading a " . $item["filename"] . " file\n";
$source = self::$api->create_source($item["filename"], $options = array('name' => 'local_test_source'));
$this->assertEquals(BigMLRequest::HTTP_CREATED, $source->code);
$this->assertEquals(1, $source->object->status->code);
print "check local source is ready\n";
$resource = self::$api->_check_resource($source->resource, null, 20000, 30);
$this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
print "I update the source with params ";
$source = self::$api->update_source($source->resource, $item["params"]);
print "create dataset with local source\n";
$dataset = self::$api->create_dataset($source->resource);
$this->assertEquals(BigMLRequest::HTTP_CREATED, $dataset->code);
$this->assertEquals(BigMLRequest::QUEUED, $dataset->object->status->code);
print "check the dataset is ready " . $dataset->resource . " \n";
$resource = self::$api->_check_resource($dataset->resource, null, 20000, 30);
$this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
print "When I ask for the missing values counts in the fields\n";
$fields = new Fields($resource["resource"]->object->fields);
print "Then the missing values counts dict is " . json_encode($item["missing_values"]) . "\n";
$this->assertEquals($item["missing_values"], $fields->missing_counts());
}
}
开发者ID:WebTales,项目名称:bigml-php,代码行数:27,代码来源:test_19_missing_and_errors.php
示例5: renderLink
public function renderLink($field, array $htmlOptions = array())
{
$fieldName = $field->fieldName;
$linkId = '';
$name = '';
$linkSource = null;
// TODO: move this code and duplicate code in X2Model::renderModelInput into a helper
// method. Might be able to use X2Model::getLinkedModel.
if (class_exists($field->linkType)) {
if (!empty($this->owner->{$fieldName})) {
list($name, $linkId) = Fields::nameAndId($this->owner->{$fieldName});
$linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true);
} else {
$linkModel = X2Model::model($field->linkType);
}
if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) {
$linkSource = Yii::app()->controller->createAbsoluteUrl($linkModel->autoCompleteSource);
$linkId = $linkModel->id;
$oldLinkFieldVal = $this->owner->{$fieldName};
$this->owner->{$fieldName} = $name;
}
}
$input = CHtml::hiddenField($field->modelName . '[' . $fieldName . '_id]', $linkId, array());
$input .= CHtml::activeTextField($this->owner, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'data-x2-link-source' => $linkSource, 'class' => 'x2-mobile-autocomplete', 'autocomplete' => 'off'), $htmlOptions));
return $input;
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:26,代码来源:MobileFieldInputRenderer.php
示例6: validateAttribute
public function validateAttribute($model, $attribute, $params = array())
{
list($name, $id) = Fields::nameAndId($model->{$attribute});
if (!ctype_digit($id)) {
$model->addError($attribute, Yii::t('app', '{attr} does not refer to any existing record', array('{attr}' => $model->getAttributeLabel($attribute))));
}
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:7,代码来源:ValidLinkValidator.php
示例7: getTreeById
public function getTreeById($id, $option = '')
{
$sql = 'SELECT * FROM {{tree}} WHERE id=' . $id;
$item = DB::getRow($sql);
$item['fields'] = Fields::getFieldsByTree($id, $option);
return $item;
}
开发者ID:sov-20-07,项目名称:billing,代码行数:7,代码来源:TreeModel.php
示例8: __construct
public function __construct()
{
if ($_GET['ref']) {
$sql = 'SELECT iuser FROM {{iusers_options}} WHERE selfcode=\'' . $_GET['ref'] . '\'';
$iuser = DB::getOne($sql);
if ($iuser) {
$_SESSION['referal'] = $iuser;
}
}
$sql = 'SELECT * FROM {{tree}} WHERE parent=410 AND visible=1 ORDER BY num';
$list = DB::getAll($sql);
foreach ($list as $item) {
$fields = Fields::getFieldsByTree($item['id'], 'wide');
$item['pic'] = $fields['files_gal']['image'][0]['path'];
$multi = Fields::getMultiFields($item['id']);
foreach ($multi['color'] as $row) {
$item['list'][$row] = Funcs::$referenceId['color'][$row]['name'];
}
Run::$colors[$item['id']] = $item;
}
//print '<pre>';print_r(Run::$colors);die;
$sql = 'SELECT * FROM {{tree}} WHERE id=1';
$row = DB::getRow($sql);
Run::$socTitle = $row['seo_title'];
Run::$socDescription = $row['seo_description'];
}
开发者ID:sov-20-07,项目名称:billing,代码行数:26,代码来源:RunModel.php
示例9: getValidFieldTypes
public function getValidFieldTypes()
{
if (!isset($this->_validFieldTypes)) {
$this->_validFieldTypes = array_keys(Fields::getFieldTypes());
}
return $this->_validFieldTypes;
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:7,代码来源:FieldFormatter.php
示例10: build_validator
public function build_validator()
{
if ($this->is_must_input) {
$validater .= ' required="required" ';
}
$validater .= Fields::build_validator();
return $validater;
}
开发者ID:AnthemiusGuo,项目名称:managerproject,代码行数:8,代码来源:Field_star.php
示例11: Fields
/**
*
* @param int $ctype
* @return Fields
*/
public function &initXFields($ctype = XFIELDS_VACANCY)
{
require_once ENGINE_DIR . '/job/classes/Fields.php';
if (!is_object($this->xfields) || $this->xfields->getType() != $ctype) {
$this->xfields = new Fields($ctype, $this);
}
return $this->xfields;
}
开发者ID:dautushenka,项目名称:Job_Centre,代码行数:13,代码来源:JobUser.php
示例12: getList
public function getList()
{
$start = microtime(true);
$data = array('list' => array(), 'categories' => array());
$parentIds = array();
$sql = '
SELECT DISTINCT {{catalog}}.*, {{tree}}.* FROM {{catalog}}
INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
WHERE {{catalog}}.market=1 AND {{catalog}}.price>0 AND {{tree}}.visible=1 AND available=1
ORDER BY num
';
//print DB::prefix($sql);
$catalog = DB::getPagi($sql);
$fields = Fields::getReserveFieldsByModulePath($tab);
$k = 1;
$date_b = explode('.', Funcs::$conf['akcia']['date_begin']);
$date_e = explode('.', Funcs::$conf['akcia']['date_end']);
$date_b = mktime(0, 0, 0, $date_b[1], $date_b[0], $date_b[2]);
$date_e = mktime(23, 59, 59, $date_e[1], $date_e[0], $date_e[2]);
$today = mktime();
$yes = 0;
if ($today >= $date_b && $today <= $date_e) {
$yes = 1;
}
foreach ($catalog as $i => $model) {
$akcia = '0';
//if ($yes==1)
//$akcia=$model['akcia'];
$data['list'][] = array('id' => $model['id'], 'parent' => $model['parent'], 'fields' => Fields::getFieldsByTree($model['tree'], 'wide'), 'name' => Market::clearInfo($model['name']), 'path' => Catalog::getPathToTree($model['tree']), 'available' => $model['available'], 'bid' => $model['bid'], 'akcia' => $akcia, 'cbid' => $model['cbid'], 'typePrefix' => $model['typePrefix'], 'vendor' => Funcs::$referenceId['vendor'][$model['vendor']]['name'], 'yandex_description' => Market::clearInfo($model['yandex_description']), 'price' => $model['price'], 'local_delivery_cost' => $model['price'] < 4000 ? '200' : '0', 'manufacturer_warranty' => $model['manufacturer_warranty']);
$parentIds[] = $model['parent'];
$k++;
//echo $k.' Время выполнения скрипта '.(microtime(true) - $start).'<br />';
}
$parentIds = array_unique($parentIds);
if (count($parentIds) > 0) {
$sql = '
SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
';
$list = DB::getAll($sql);
$parentIds = array();
foreach ($list as $item) {
$data['categories'][] = array('id' => $item['id'], 'parent' => $item['parent'], 'name' => $item['name']);
$parentIds[] = $item['parent'];
}
if (count($parentIds) > 0) {
$sql = '
SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
';
$list = DB::getAll($sql);
foreach ($list as $item) {
$data['categories'][] = array('id' => $item['id'], 'name' => $item['name']);
}
}
}
return $data;
}
开发者ID:sov-20-07,项目名称:billing,代码行数:56,代码来源:MarketModel.php
示例13: test_scenario1
public function test_scenario1()
{
$data = array(array('filename' => 'data/iris.csv', 'objective_column' => 0, 'objective_id' => '000000'));
foreach ($data as $item) {
print "\nSuccessfully creating a Fields object\n";
print "Given I create a data source uploading a " . $item["filename"] . " file\n";
$source = self::$api->create_source($item["filename"], $options = array('name' => 'local_test_source', 'project' => self::$project->resource));
$this->assertEquals(BigMLRequest::HTTP_CREATED, $source->code);
$this->assertEquals(1, $source->object->status->code);
print "And I wait until the source is ready\n";
$resource = self::$api->_check_resource($source->resource, null, 3000, 30);
$this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
$source = self::$api->get_source($source->resource);
print "And I create a Fields object from the source with objective column " . $item["objective_column"] . "\n";
$fields = new Fields($source, null, null, null, intval($item["objective_column"]), true);
print "Then the object id is " . $item["objective_id"] . "\n";
$this->assertEquals($fields->field_id($fields->objective_field), $item["objective_id"]);
}
}
开发者ID:antoniomachine,项目名称:bigml-php,代码行数:19,代码来源:test_27_fields.php
示例14: getOne
public function getOne($id)
{
if ($_POST) {
if (Spage::send($id)) {
View::$layout = 'empty';
View::render('site/redirect', array('href' => '/vacancy/', 'text' => 'Заявка принята!\\nМы свяжемся с Вами в ближайшее время'));
}
}
$field = Fields::getFieldsByTree($id, 'wide');
return $field;
}
开发者ID:sov-20-07,项目名称:billing,代码行数:11,代码来源:SpageModel.php
示例15: queryFields
protected function queryFields()
{
if (!isset(self::$_fields[$this->tableName()])) {
// only look up fields if they haven't already been looked up
if (get_class($this) === 'Product' || get_class($this) === 'Quote') {
self::$_fields[$this->tableName()] = Fields::model()->findAllByAttributes(array('modelName' => get_class($this) . 's'));
} else {
self::$_fields[$this->tableName()] = Fields::model()->findAllByAttributes(array('modelName' => get_class($this)));
}
}
//Yii::app()->db->createCommand()->select('*')->from('x2_fields')->where('modelName="'.get_class($this).'"')->queryAll();
}
开发者ID:netconstructor,项目名称:X2Engine,代码行数:12,代码来源:X2Model.php
示例16: initFields
/**
* Fields initialization
* This method set the initial fields descriptio for this DataObjec
* Each property in the values array will be stored
* in the model (database).
* The Fields object let you assign to it FieldType and
* manipulates the FieldType properties.
* Field type define how a property value will display in a context of a Form
* or general Display.
*
* All the base FieldType are describe here:
* http://radria.sqlfusion.com/documentation/core:registry:creating_new_field_types
* You can create your own:
* http://radria.sqlfusion.com/documentation/core:registry:creating_new_field_types
* Some extra package add fieldtype from Dojo or other jquery frameworks.
*/
function initFields()
{
$invoice_fields = new Fields();
$invoice_fields->addField(new FieldTypeInt('idinvoice'));
$invoice_fields->addField(new FieldTypeChar('num'));
$invoice_fields->addField(new FieldTypeInt('iduser'));
$invoice_fields->addField(new FieldTypeText('description'));
$invoice_fields->addField(new FieldTypeFloat('amount'));
$invoice_fields->addField(new FieldTypeDateSQL('datepaid'));
$invoice_fields->addField(new FieldTypeDateSQL('datecreated'));
$invoice_fields->addfield(new FieldTypeListBoxSmall('status'));
$invoice_fields->idinvoice->hidden = 1;
$invoice_fields->iduser->hidden = 1;
$invoice_fields->description->rows = 10;
$invoice_fields->description->cols = 40;
$invoice_fields->amount->numberformat = '$:1:.:,:';
$invoice_fields->status->listvalues = 'New:Sent:Paid';
$invoice_fields->status->listlabels = 'new:sent:paid';
$invoice_fields->status->emptydefault = 'no';
$this->setFields($invoice_fields);
}
开发者ID:philfree,项目名称:radria,代码行数:37,代码来源:Invoice.class.php
示例17: getRSS
public static function getRSS()
{
$data = array();
$id = Tree::getIdTreeByModule('news');
$sql = 'SELECT * FROM {{tree}} WHERE parent=' . $id . ' AND visible=1 ORDER BY udate DESC LIMIT 0,10';
$list = DB::getAll($sql);
foreach ($list as $item) {
$field = Fields::getFieldsByTree($item['id']);
$data[] = array('id' => $item['id'], 'name' => trim(strip_tags($item['name'])), 'preview' => strip_tags($field['preview']), 'path' => 'http:://' . $_SERVER['HTTP_HOST'] . '/about/news/' . $item['id'] . '/', 'udate' => date("D, d M Y H:i:s O", strtotime($item['udate'])));
}
return array('list' => $data);
}
开发者ID:sov-20-07,项目名称:billing,代码行数:12,代码来源:ArticlesModel.php
示例18: Preview
private function Preview()
{
$products_with_variations = isset($this->data["products_with_variations"]) ? $this->data["products_with_variations"] : 'Off';
$orders_with_fancy = isset($this->data["orders_with_fancy"]) ? $this->data["orders_with_fancy"] : 'Off';
$filter = array("recordsstatus" => $this->data["recordsstatus"], "recordsauthor" => $this->data["recordsauthor"], "date-from" => $this->data["date-from"], "date-to" => $this->data["date-to"], "datatype" => $this->data["datatype"], "products_with_variations" => $products_with_variations, "orders_with_fancy" => $orders_with_fancy, "order" => "ID" . " ASC", "limit" => 500);
if (isset($this->data["prod-cats"])) {
$filter["prod-cats"] = $this->data["prod-cats"];
}
$view = new View("views/datatable");
$view->setArray(array("fields" => Fields::Get($this->data["datatype"]), "data" => $this->core->GetData($filter), "totalfound" => $this->core->totalfound, "datatype" => $this->data["datatype"]));
echo json_encode(array("success" => true, "datatable" => $view->render(false)));
}
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:12,代码来源:Ajax.php
示例19: statusList
public static function statusList()
{
$field = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'status'));
$dropdown = Dropdowns::model()->findByPk($field->linkType);
return json_decode($dropdown->options);
/*
return array(
'Draft'=>Yii::t('quotes','Draft'),
'Presented'=>Yii::t('quotes','Presented'),
"Issued"=>Yii::t('quotes','Issued'),
"Won"=>Yii::t('quotes','Won')
); */
}
开发者ID:netconstructor,项目名称:X2Engine,代码行数:13,代码来源:Quote.php
示例20: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'quotes';
$model = $this->getModel($id);
if (!$this->checkPermissions($model, 'view')) {
$this->denied();
}
$quoteProducts = $model->lineItems;
// add quote to user's recent item list
User::addRecentItem('q', $id, Yii::app()->user->getId());
$contactNameId = Fields::nameAndId($model->associatedContacts);
$contactId = $contactNameId[1];
parent::view($model, $type, array('orders' => $quoteProducts, 'contactId' => $contactId));
}
开发者ID:xl602,项目名称:X2CRM,代码行数:18,代码来源:QuotesController.php
注:本文中的Fields类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论