当前位置: 首页>>代码示例>>PHP>>正文


PHP ColumnMap::isNotNull方法代码示例

本文整理汇总了PHP中ColumnMap::isNotNull方法的典型用法代码示例。如果您正苦于以下问题:PHP ColumnMap::isNotNull方法的具体用法?PHP ColumnMap::isNotNull怎么用?PHP ColumnMap::isNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ColumnMap的用法示例。


在下文中一共展示了ColumnMap::isNotNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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));
    }
  }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:61,代码来源:sfCrudGenerator.class.php

示例2: getWidgetOptionsForColumn

 /**
  * Returns a PHP string representing options to pass to a widget for a given column.
  *
  * @param  ColumnMap $column  A ColumnMap object
  *
  * @return string    The options to pass to the widget as a PHP string
  */
 public function getWidgetOptionsForColumn(ColumnMap $column)
 {
     $options = array();
     $withEmpty = $column->isNotNull() && !$column->isForeignKey() ? array("'with_empty' => false") : array();
     switch ($column->getType()) {
         case PropelColumnTypes::BOOLEAN:
             $options[] = "'choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no')";
             break;
         case PropelColumnTypes::DATE:
         case PropelColumnTypes::TIME:
         case PropelColumnTypes::TIMESTAMP:
             $options[] = "'from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate()";
             $options = array_merge($options, $withEmpty);
             break;
         default:
             $options = array_merge($options, $withEmpty);
     }
     if ($column->isForeignKey()) {
         $options[] = sprintf('\'model\' => \'%s\', \'add_empty\' => true', $this->getForeignTable($column)->getClassname());
         $refColumn = $this->getForeignTable($column)->getColumn($column->getRelatedColumnName());
         if (!$refColumn->isPrimaryKey()) {
             $options[] = sprintf('\'key_method\' => \'get%s\'', $refColumn->getPhpName());
         }
     }
     return count($options) ? sprintf('array(%s)', implode(', ', $options)) : '';
 }
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:33,代码来源:sfPropelFormFilterGenerator.class.php

示例3: getWidgetOptionsForColumn

 /**
  * Returns a PHP string representing options to pass to a widget for a given column.
  *
  * @param  ColumnMap $column  A ColumnMap object
  *
  * @return string    The options to pass to the widget as a PHP string
  */
 public function getWidgetOptionsForColumn(ColumnMap $column)
 {
     $options = array();
     $withEmpty = sprintf('\'with_empty\' => %s', $column->isNotNull() ? 'false' : 'true');
     switch ($column->getType()) {
         case PropelColumnTypes::BOOLEAN:
             $options[] = "'choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no')";
             break;
         case PropelColumnTypes::DATE:
         case PropelColumnTypes::TIME:
         case PropelColumnTypes::TIMESTAMP:
             $options[] = "'from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate()";
             $options[] = $withEmpty;
             break;
     }
     if ($column->isForeignKey()) {
         $options[] = sprintf('\'model\' => \'%s\', \'add_empty\' => true', $this->getForeignTable($column)->getClassname());
     }
     return count($options) ? sprintf('array(%s)', implode(', ', $options)) : '';
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:27,代码来源:sfPropelFormFilterGenerator.class.php


注:本文中的ColumnMap::isNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。