當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfInflector::tableize方法代碼示例

本文整理匯總了PHP中sfInflector::tableize方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfInflector::tableize方法的具體用法?PHP sfInflector::tableize怎麽用?PHP sfInflector::tableize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sfInflector的用法示例。


在下文中一共展示了sfInflector::tableize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: extendEvent

 /**
  * Can be used inside a magic __call method to allow for a class to be extended
  * 
  * This method will throw a class_name.method_not_found event,
  * where class_name is the "tableized" class name.
  * 
  * @example
  * public function __call($method, $arguments)
  * {
  *   return sfSympalExtendClass::extendEvent($this, $method, $arguments);
  * }
  * 
  * @param mixed $subject Instance of the class being extended
  * @param string $method The current method being called
  * @param array $arguments The arguments being passed to the above methid
  */
 public static function extendEvent($subject, $method, $arguments)
 {
     $name = sfInflector::tableize(get_class($subject));
     $event = ProjectConfiguration::getActive()->getEventDispatcher()->notifyUntil(new sfEvent($subject, $name . '.method_not_found', array('method' => $method, 'arguments' => $arguments)));
     if (!$event->isProcessed()) {
         throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($subject), $method));
     }
     return $event->getReturnValue();
 }
開發者ID:bmatychowiak,項目名稱:sympal,代碼行數:25,代碼來源:sfSympalExtendClass.class.php

示例2: linkToObject

  public function linkToObject($class, $html, $params)
  {
    $showRoute = sfInflector::tableize($class) . '_show';
    $routes    = sfContext::getInstance()->getRouting()->getRoutes();

    if (isset($routes[$showRoute]) && $routes[$showRoute] instanceof sfDoctrineRoute) {
      $options = $routes[$showRoute]->getOptions();
      if ($options['model'] == $class) {
        $html = sprintf("link_to(%s, '%s', %s)", $html, $showRoute, $html);
      }
    }

    return $html;
  }
開發者ID:romankallweit,項目名稱:swingmachine,代碼行數:14,代碼來源:sfHadoriGenerator.class.php

示例3: installPlugin

function installPlugin($name, $t)
{
    // Install the plugin
    $manager = sfSympalPluginManager::getActionInstance($name, 'install');
    $manager->install();
    // Check that content type was created
    $contentTypeName = $manager->getContentTypeForPlugin($name);
    $contentType = Doctrine_Core::getTable('sfSympalContentType')->findOneByName($contentTypeName);
    $t->is($contentType['name'], $contentTypeName, 'Test content type name set');
    $t->is($contentType['label'], sfInflector::humanize(sfInflector::tableize(str_replace('sfSympal', null, $contentTypeName))), 'Test content type label set');
    $t->is($contentType['plugin_name'], $name, 'Test content type plugin name set');
    $contentList = Doctrine_Core::getTable('sfSympalContentList')->findOneByContentTypeId($contentType['id']);
    $t->is($contentList instanceof sfSympalContentList, true, 'Test sample content list was created.');
    $menuItem = Doctrine_Core::getTable('sfSympalMenuItem')->findOneByContentId($contentList['content_id']);
    $t->is($menuItem instanceof sfSympalMenuItem, true, 'Test menu item to sample content list was created.');
}
開發者ID:RafalJachimczyk,項目名稱:sympal,代碼行數:16,代碼來源:PluginManager2Test.php

示例4: joinForTableProxy

 public function joinForTableProxy(Doctrine_Query $q, array $options = array())
 {
     $options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     $q->getRootAlias();
     // fix for initialize root
     if (empty($options['parentTable'])) {
         $parentTable = $q->getRoot();
         $parentTableAlias = $q->getRootAlias();
     } else {
         $parentTable = Doctrine::getTable($options['parentTable']);
         $parentTableAlias = empty($options['parentTableAlias']) ? $q->getSqlTableAlias(sfInflector::tableize($options['parentTable'])) : $options['parentTableAlias'];
     }
     if (!empty($options['componentAlias'])) {
         $componentAlias = $options['componentAlias'];
     } elseif ($parentTable->hasRelation($this->_table->getComponentName())) {
         $componentAlias = $this->_table->getComponentName();
     } else {
         $componentName = $this->_table->getComponentName();
         $relations = $parentTable->getRelations();
         foreach ($relations as $relation) {
             if ($relation['class'] == $componentName) {
                 $componentAlias = $relation['alias'];
                 break;
             }
         }
     }
     $tableAlias = empty($options['tableAlias']) ? $this->_table->getAlias() : $options['tableAlias'];
     $q->addSqlTableAlias($tableAlias, sfInflector::tableize($this->_table->getComponentName()));
     $q->leftJoin($parentTableAlias . '.' . $componentAlias . ' ' . $tableAlias);
     if ($options['withI18n'] == true && $this->_table->hasTemplate('Doctrine_Template_I18nMod')) {
         $cultures = empty($options['cultures']) ? sfContext::getInstance()->getUser()->getCulture() : $options['cultures'];
         $chunkWith = implode(' AND ', array_fill(0, count($cultures), ' ' . $tableAlias . '_trans.lang = ? '));
         $q->leftJoin($tableAlias . '.Translation ' . $tableAlias . '_trans WITH ' . $chunkWith, $cultures);
     }
     return $q;
 }
開發者ID:relo-san,項目名稱:dinDoctrineExtraPlugin,代碼行數:36,代碼來源:Doctrine_Template_Joinable.php

示例5: executeEmail

 /**
  * Execute share by email method
  * 
  * @param sfWebRequest $request
  */
 public function executeEmail(sfWebRequest $request)
 {
     $user = $this->getUser();
     $search_public_models = sfConfig::get('app_rt_search_public_models', array('rtShopProduct', 'rtShopCategory', 'rtBlogPage', 'rtSitePage', 'rtWikiPage'));
     $this->model = $request->getParameter('model');
     $this->model_id = $request->getParameter('model_id');
     $this->route_name = sfInflector::tableize($this->model) . '_show';
     $this->object = Doctrine_Core::getTable($this->model)->find(array($this->model_id));
     // Exception handling
     if (!in_array($this->model, $search_public_models) || !$this->object) {
         throw new sfException(sprintf('Object %s does not exist.', $this->model));
     }
     // Form
     $this->form = new rtSocialEmailPublicForm();
     if ($this->getRequest()->isMethod('PUT') || $this->getRequest()->isMethod('POST')) {
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             $form_values = $this->form->getValues();
             $this->notifyAudience($this->object, $form_values, $this->route_name);
         } else {
             $this->getUser()->setFlash('default_error', true, false);
         }
     }
 }
開發者ID:pierswarmers,項目名稱:rtCorePlugin,代碼行數:29,代碼來源:BasertSocialActions.class.php

示例6: get_partial

    echo get_partial('sympal_default/render_form', array('form' => $embeddedForms[$name]));
    ?>
  </div>
<?php 
} else {
    ?>
  <div class="sf_admin_form_row<?php 
    $widget->hasError() and print ' errors';
    $validatorSchema[$name]->getOption('required') and print ' required';
    ?>
">
    <?php 
    if ($help = $widget->renderHelp()) {
        ?>
      <?php 
        $helpId = sfInflector::tableize($name) . '_help';
        ?>
      <span id="<?php 
        echo $helpId;
        ?>
" class="help" style="float: right;" title="<?php 
        echo strip_tags($help);
        ?>
">
        <?php 
        echo image_tag('/sf/sf_admin/images/help.png');
        ?>
      </span>
    <?php 
    }
    ?>
開發者ID:sympal,項目名稱:sympal,代碼行數:31,代碼來源:_render_form_widget.php

示例7: image_tag

<tr>  
  <td class="values">
      <?php 
echo $form->renderHiddenFields();
?>
      <?php 
echo sfInflector::humanize(sfInflector::tableize($form['keyword_type']->getValue()));
?>
  </td>
  <td>
    <?php 
echo $form['keyword_type']->renderError();
?>
    <?php 
echo $form['keyword'];
?>
  </td>
  <td class="widget_row_delete">
      <?php 
echo image_tag('remove.png', 'alt=Delete class=clear_prop id=' . $form['keyword_type']->getValue());
?>
  </td>
</tr>
開發者ID:naturalsciences,項目名稱:Darwin,代碼行數:23,代碼來源:_nameValue.php

示例8: use_helper

<?php

/*
 * Important set of helper variables for usage in the layout template.
 *
 * 
 */
use_helper('rtTemplate');
$routes = $sf_context->getRouting()->getRoutes();
$module = $sf_request->getParameter('module');
$action = $sf_request->getParameter('action');
$area_class = Doctrine_Inflector::urlize(sfInflector::tableize($module));
$area_class .= ' ' . $area_class . '-' . Doctrine_Inflector::urlize(sfInflector::tableize($action));
$snippet_area = Doctrine_Inflector::urlize(sfInflector::tableize($module) . '-' . sfInflector::tableize($action));
開發者ID:pierswarmers,項目名稱:rtBoilerplatePlugin,代碼行數:14,代碼來源:_init.php

示例9: tableize

 /**
  * Camel case to underscored.
  *
  * @param $string
  * @return string
  */
 private function tableize($string)
 {
     return sfInflector::tableize($string);
 }
開發者ID:pierswarmers,項目名稱:rtCorePlugin,代碼行數:10,代碼來源:rtViewToolkit.php

示例10: init

 public function init()
 {
     $this->_eventName = sfInflector::tableize($this->_table->getOption('name'));
 }
開發者ID:slemoigne,項目名稱:sympal,代碼行數:4,代碼來源:sfSympalRecordEventFilter.class.php

示例11: setInvoker

 /**
  * Override the setInvoker() method to allow us to generate the event name
  *
  * @param Doctrine_Record_Abstract $invoker 
  * @return void
  */
 public function setInvoker(Doctrine_Record_Abstract $invoker)
 {
     parent::setInvoker($invoker);
     $this->_eventName = sfInflector::tableize(get_class($invoker));
 }
開發者ID:slemoigne,項目名稱:sympal,代碼行數:11,代碼來源:sfSympalRecordTemplate.class.php

示例12: include_stylesheets_for_form

<?php

include_stylesheets_for_form($form);
include_javascripts_for_form($form);
?>

<span id="sympal_content_slot_<?php 
echo $contentSlot->getId();
?>
_editor_form" class="sympal_<?php 
echo sfInflector::tableize($contentSlot->getType());
?>
_content_slot_editor_form">
  <?php 
echo $form->renderHiddenFields();
?>

  <?php 
echo sfSympalToolkit::getSymfonyResource($contentSlot->getSlotEditFormRenderer(), array('contentSlot' => $contentSlot, 'form' => $form));
?>
</span>

<script type="text/javascript">
<?php 
if ($contentSlot->getType() == 'Markdown' && sfSympalConfig::get('enable_markdown_editor', null, true)) {
    ?>
$(function() {
  $('#sympal_content_slot_<?php 
    echo $contentSlot->getId();
    ?>
_editor_form textarea').markItUp(mySettings);
開發者ID:slemoigne,項目名稱:sympal,代碼行數:31,代碼來源:_slot_editor_form.php

示例13: renameModel

 /**
  * Rename model functionality
  *
  * @param string $name 
  * @return afResponse
  * @author Sergey Startsev
  */
 public function renameModel($name)
 {
     $response = afResponseHelper::create();
     $are_writable = $this->isModelWritable();
     if ($are_writable !== true) {
         return $are_writable;
     }
     if (!afStudioModelCommandHelper::isValidName($name)) {
         return $response->success(false)->message('Model name can only consist from alphabetical characters and begins from letter or "_"');
     }
     $this->originalSchemaArray[$this->getSchemaFile()]['propel'][$this->getTableName()]['_attributes']['phpName'] = $name;
     $newTableName = sfInflector::tableize($name);
     $this->originalSchemaArray[$this->getSchemaFile()]['propel'][$newTableName] = $this->originalSchemaArray[$this->getSchemaFile()]['propel'][$this->getTableName()];
     unset($this->originalSchemaArray[$this->getSchemaFile()]['propel'][$this->getTableName()]);
     if ($this->saveSchema()) {
         afStudioConsole::getInstance()->execute('sf afs:fix-perms');
         list($status, $message) = afStudioModelCommandHelper::renameModel($this->getModelName(), $name);
         afStudioModelCommandHelper::removeModelFiles($this->getModelName());
         return $response->success(true)->message("Renamed model's phpName from <b>{$this->getModelName()}</b> to <b>{$name}</b><br><b style=\"color:red;\">Please make sure you'll update all the widgets that are using the old model name with the renamed model name, else you'll be facing some errors when trying to load those widgets!</b>!" . (!empty($message) ? "<br/>" . nl2br($message) : ''))->console(afStudioModelCommandHelper::deploy());
     }
     return $response->success(false)->message("Can't rename model's phpName from <b>{$this->getModelName()}</b> to <b>{$name}</b>!");
 }
開發者ID:cbsistem,項目名稱:appflower_studio,代碼行數:29,代碼來源:afStudioModelCommandModificator.class.php

示例14: __call

 public function __call($method, $arguments)
 {
     if (substr($method, 0, 3) == 'get') {
         $name = substr($method, 3, strlen($method));
         $name = sfInflector::tableize($name);
         return $this->get($name, $arguments);
     }
 }
開發者ID:sympal,項目名稱:sympal,代碼行數:8,代碼來源:sfSympalPluginInfo.class.php

示例15: getReadableKeywordType

 public function getReadableKeywordType()
 {
     return sfInflector::humanize(sfInflector::tableize($this->getKeywordType()));
 }
開發者ID:naturalsciences,項目名稱:Darwin,代碼行數:4,代碼來源:ClassificationKeywords.class.php


注:本文中的sfInflector::tableize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。