本文整理汇总了PHP中DataType::getInputType方法的典型用法代码示例。如果您正苦于以下问题:PHP DataType::getInputType方法的具体用法?PHP DataType::getInputType怎么用?PHP DataType::getInputType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType::getInputType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetInputType
/**
* test if the method getInputType returns the correct inputtype
*/
public function testGetInputType()
{
$DataType = new DataType();
$this->assertEquals('number', $DataType->getInputType('int'));
$this->assertEquals('checkbox', $DataType->getInputType('bool'));
$this->assertEquals('file', $DataType->getInputType('blob'));
$this->assertEquals('single', $DataType->getInputType('binary'));
$this->assertEquals('text', $DataType->getInputType('text'));
$this->assertEquals('select-multiple', $DataType->getInputType('set'));
$this->assertEquals('date', $DataType->getInputType('date'));
$this->assertEquals('datetime', $DataType->getInputType('datetime'));
$this->assertEquals('number', $DataType->getInputType('year'));
}
示例2: run
public function run()
{
$type = DataType::getInputType($this->column->dbType);
$this->htmlOptions += $this->fixedHtmlOptions[$type];
$column = $this->column->name;
$name = isset($this->htmlOptions['name']) ? $this->htmlOptions['name'] : 'Row[' . $column . ']';
switch ($type) {
case 'number':
echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
break;
case 'select':
echo CHtml::activeDropDownList($this->row, $column, $this->getEnumValues(), $this->htmlOptions);
break;
case 'select-multiple':
#echo CHtml::activeListBox($this->row, $column, $this->getSetValues(), $this->htmlOptions);
echo CHtml::listBox($name, $this->row->getAttributeAsArray($column), $this->getSetValues(), $this->htmlOptions);
break;
case 'text':
echo CHtml::activeTextArea($this->row, $column, $this->htmlOptions);
break;
case 'file':
echo '<script type="text/javascript">
$(document).ready(function() {
$("# echo CHtml::$idPrefix; ?>").submit(function() {
alert("ok1");
});
});
</script>';
echo CHtml::activeFileField($this->row, $column, $this->htmlOptions);
break;
case 'date':
$this->SetDateTimeHtmlOptions($column);
echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
echo '<script type="text/javascript">
$(document).ready(function() {
$("#' . $this->htmlOptions['id'] . '").datepicker({showOn: "button", dateFormat: "yy-mm-dd", buttonImage: "' . ICONPATH . '/16/calendar.png' . '", buttonImageOnly: true, buttonText: "' . Yii::t('core', 'showCalendar') . '"});
});
</script>';
break;
case 'datetime':
$this->SetDateTimeHtmlOptions($column);
echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
echo '<script type="text/javascript">
$(document).ready(function() {
now = new Date();
$("#' . $this->htmlOptions['id'] . '").datepicker({showOn: "button", dateFormat: "yy-mm-dd " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(), buttonImage: "' . ICONPATH . '/16/calendar.png' . '", buttonImageOnly: true, buttonText: "' . Yii::t('core', 'showCalendar') . '"});
});
</script>';
break;
default:
echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
break;
}
}
示例3: getOriginalIdentifier
/**
* @return array key value pairs of primary key (if no primary key, all column values will be returned)
*/
public function getOriginalIdentifier()
{
$table = $this->getMetaData()->tableSchema;
if (is_string($table->primaryKey)) {
return array($table->primaryKey => $this->originalAttributes[$table->primaryKey]);
} else {
if (is_array($table->primaryKey)) {
$values = array();
foreach ($table->primaryKey as $name) {
$values[$name] = $this->originalAttributes[$name];
}
return $values;
} else {
$values = array();
foreach ($table->columns as $column) {
if (DataType::getInputType($column->dbType) != "file") {
$values[$column->name] = $this->originalAttributes[$column->name];
}
}
return $values;
}
}
}
示例4: foreach
<?php
}
?>
<?php
} else {
?>
<?php
foreach ($row as $key => $value) {
?>
<td class="<?php
echo $key;
?>
">
<?php
if ($model->singleTableSelect && DataType::getInputType($model->getTable()->columns[$key]->dbType) == "file" && $value) {
?>
<?php
if ($model->hasPrimaryKey()) {
?>
<a href="javascript:void(0);" class="icon" onclick="globalBrowse.download('<?php
echo Yii::app()->createUrl('row/download');
?>
', {key: JSON.stringify(keyData[<?php
echo $i;
?>
]), column: '<?php
echo $key;
?>
', table: '<?php
echo $model->table;
示例5: getKeyData
public function getKeyData()
{
$keyData = array();
$i = 0;
foreach ($this->getData() as $row) {
foreach ($row as $key => $value) {
if ($this->getIsUpdatable() && (!$this->hasPrimaryKey() || $this->isPrimaryKey($key)) && DataType::getInputType($this->getTable()->columns[$key]->dbType) != "file") {
$keyData[$i][$key] = is_null($value) ? null : $value;
}
}
$i++;
}
return $keyData;
}