Development

Changeset 27890

You must first sign up to be able to contribute.

Changeset 27890

Show
Ignore:
Timestamp:
02/11/10 14:24:24 (3 years ago)
Author:
ornicar2
Message:

[Diem][dmTagPlugin]
- added an admin autocompleter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/dmTagPlugin/lib/model/doctrine/PluginDmTagTable.class.php

    r27788 r27890  
    44class PluginDmTagTable extends myDoctrineTable 
    55{ 
    6   protected 
    7   $taggableModelsLoaded; 
    86 
    9   public function loadTaggableModels() 
     7  public function getTagNames() 
    108  { 
    11     if($this->taggableModelsLoaded) 
    12     { 
    13       return; 
    14     } 
    15  
    16     foreach(dmProject::getAllModels() as $model) 
    17     { 
    18       if(!class_exists($model, false)) 
    19       { 
    20         dmDb::table($model); 
    21       } 
    22     } 
    23  
    24     $this->taggableModelsLoaded = true; 
     9    return $this->createQuery('t') 
     10    ->select('t.name') 
     11    ->fetchFlat(); 
    2512  } 
    2613 
    2714  public function getPopularTagsQuery($relations = null, $limit = null, dmDoctrineQuery $q = null) 
    2815  { 
    29     $this->loadTaggableModels(); 
    30      
    3116    if (empty($relations)) 
    3217    { 
  • plugins/dmTagPlugin/modules/dmTagAdmin/actions/actions.class.php

    r27788 r27890  
    1414class dmTagAdminActions extends autoDmTagAdminActions 
    1515{ 
     16 
     17  public function executeGetTagsForAutocomplete(sfWebRequest $request) 
     18  { 
     19    $tags = dmDb::query('DmTag t') 
     20    ->select('t.name as value, t.name as caption') 
     21    ->fetchArray(); 
     22 
     23    return $this->renderJson($tags); 
     24  } 
     25 
    1626}