本文整理汇总了PHP中ColumnMap::getCreoleType方法的典型用法代码示例。如果您正苦于以下问题:PHP ColumnMap::getCreoleType方法的具体用法?PHP ColumnMap::getCreoleType怎么用?PHP ColumnMap::getCreoleType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColumnMap
的用法示例。
在下文中一共展示了ColumnMap::getCreoleType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValidatorClassForColumn
/**
* Returns a sfValidator class name for a given column.
*
* @param ColumnMap $column A ColumnMap object
*
* @return string The name of a subclass of sfValidator
*/
public function getValidatorClassForColumn(ColumnMap $column)
{
switch ($column->getCreoleType()) {
case CreoleTypes::BOOLEAN:
$name = 'Boolean';
break;
case CreoleTypes::CHAR:
case CreoleTypes::VARCHAR:
case CreoleTypes::LONGVARCHAR:
$name = 'String';
break;
case CreoleTypes::DOUBLE:
case CreoleTypes::FLOAT:
case CreoleTypes::NUMERIC:
case CreoleTypes::DECIMAL:
case CreoleTypes::REAL:
$name = 'Number';
break;
case CreoleTypes::INTEGER:
case CreoleTypes::SMALLINT:
case CreoleTypes::TINYINT:
case CreoleTypes::BIGINT:
case CreoleTypes::YEAR:
$name = 'Integer';
break;
case CreoleTypes::DATE:
$name = 'Date';
break;
case CreoleTypes::TIME:
$name = 'Time';
break;
case CreoleTypes::TIMESTAMP:
$name = 'DateTime';
break;
default:
$name = 'Pass';
}
if ($column->isPrimaryKey() || $column->isForeignKey()) {
$name = 'PropelChoice';
}
return sprintf('sfValidator%s', $name);
}
示例2: getCrudColumnEditTag
/**
* Returns HTML code for a column in edit mode.
*
* @param ColumnMap $column The column name
* @param array $params The parameters
*
* @return string HTML code
*/
public function getCrudColumnEditTag($column, $params = array())
{
$type = $column->getCreoleType();
if ($column->isForeignKey())
{
if (!$column->isNotNull() && !isset($params['include_blank']))
{
$params['include_blank'] = true;
}
return $this->getPHPObjectHelper('select_tag', $column, $params, array('related_class' => $this->getRelatedClassName($column)));
}
else if ($type == CreoleTypes::DATE)
{
// rich=false not yet implemented
return $this->getPHPObjectHelper('input_date_tag', $column, $params, array('rich' => true));
}
else if ($type == CreoleTypes::TIMESTAMP)
{
// rich=false not yet implemented
return $this->getPHPObjectHelper('input_date_tag', $column, $params, array('rich' => true, 'withtime' => true));
}
else if ($type == CreoleTypes::BOOLEAN)
{
return $this->getPHPObjectHelper('checkbox_tag', $column, $params);
}
else if ($type == CreoleTypes::CHAR || $type == CreoleTypes::VARCHAR)
{
$fieldMin = $this->getParameterValue('defaults.edit.char_min', 20);
$fieldMax = $this->getParameterValue('defaults.edit.char_max', 80);
$size = ($column->getSize() > $fieldMin ? ($column->getSize() < $fieldMax ? $column->getSize() : $fieldMax) : $fieldMin);
return $this->getPHPObjectHelper('input_tag', $column, $params, array('size' => $size));
}
else if ($type == CreoleTypes::INTEGER || $type == CreoleTypes::TINYINT || $type == CreoleTypes::SMALLINT || $type == CreoleTypes::BIGINT)
{
$size = $this->getParameterValue('defaults.edit.int_size', 7);
return $this->getPHPObjectHelper('input_tag', $column, $params, array('size' => $size));
}
else if ($type == CreoleTypes::FLOAT || $type == CreoleTypes::DOUBLE || $type == CreoleTypes::DECIMAL || $type == CreoleTypes::NUMERIC || $type == CreoleTypes::REAL)
{
$size = $this->getParameterValue('defaults.edit.float_size', 7);
return $this->getPHPObjectHelper('input_tag', $column, $params, array('size' => $size));
}
else if ($type == CreoleTypes::TEXT || $type == CreoleTypes::LONGVARCHAR)
{
$size = $this->getParameterValue('defaults.edit.text_size', '80x5');
return $this->getPHPObjectHelper('textarea_tag', $column, $params, array('size' => $size));
}
else
{
return $this->getPHPObjectHelper('input_tag', $column, $params, array('disabled' => true));
}
}