Beispiel #1
0
 /**
  * Get flexigrid object for packages.
  * 
  * @return Curry_Flexigrid
  */
 private function getPackageGrid()
 {
     $flexigrid = new Curry_Flexigrid('PackageManager', 'Packages', url('', array("module", "view" => "Json")));
     $flexigrid->setPrimaryKey('name');
     $flexigrid->addLinkButton('Install / Upgrade', 'icon_package_add', url('', array('module', 'view' => 'Install')), 1);
     $flexigrid->addLinkButton('Remove', 'icon_package_delete', url('', array('module', 'view' => 'Remove')), 1);
     $flexigrid->addDialogButton('Show details', 'icon_magnifier', 'PackageManagerDetails', 'Show details', url('', array('module', 'view' => 'Details')), array(), 1);
     $flexigrid->addSeparator();
     $flexigrid->addLinkButton('Update repositories', 'icon_world_go', url('', array('module', 'view' => 'UpdateRepositories')));
     $flexigrid->addLinkButton('Manage repositories', 'icon_world_edit', url('', array('module', 'view' => 'Repositories')), -1);
     $flexigrid->addColumn('icon', '', array('width' => 20, 'sortable' => false));
     $flexigrid->addColumn('name', 'Name', array('width' => 150, 'sortable' => false));
     $flexigrid->addColumn('installed_version', 'Installed version', array('width' => 100, 'sortable' => false));
     $flexigrid->addColumn('version', 'Latest version', array('width' => 100, 'sortable' => false));
     $flexigrid->addColumn('size', 'Size', array('width' => 50, 'sortable' => false));
     $flexigrid->addColumn('summary', 'Summary', array('sortable' => false));
     return $flexigrid;
 }
Beispiel #2
0
 /**
  * Constructor.
  *
  * @param string $modelClass
  * @param string $url
  * @param array $options
  * @param ModelCriteria|null $query
  * @param string|null $id
  * @param string|null $title
  */
 public function __construct($modelClass, $url, $options = array(), $query = null, $id = null, $title = null)
 {
     // Accept Peerclass instead of modelclass for backwards compatibility
     if (substr($modelClass, -4) == 'Peer') {
         $modelClass = substr($modelClass, 0, -4);
         trace("Deprecated: Use plain modelClass instead of PeerClass for Flexigrid_Propel");
     }
     if ($id === null) {
         $id = $modelClass . "_flexigrid";
     }
     if ($title === null) {
         $title = $modelClass . "s";
     }
     parent::__construct($id, $title, $url, $options);
     $this->modelClass = $modelClass;
     if ($query) {
         $this->setCriteria($query);
     } else {
         $this->query = PropelQuery::from($this->modelClass);
     }
     $this->tableMap = PropelQuery::from($this->modelClass)->getTableMap();
     $colNames = array_map(create_function('$col', 'return strtolower($col->getName());'), $this->tableMap->getColumns());
     foreach ($colNames as $colName) {
         $this->addColumn($colName, ucfirst(str_replace("_", " ", $colName)));
     }
     // Autoset the primary key if it's only one and hide it
     $pkColumns = $this->tableMap->getPrimaryKeys();
     if (count($pkColumns) == 1) {
         $pkColName = strtolower(array_pop($pkColumns)->getName());
         $this->setPrimaryKey($pkColName);
         $this->setColumnOption($pkColName, array('hide' => true));
     }
     if (in_array('sortable', array_keys($this->tableMap->getBehaviors()))) {
         $this->makeSortable();
         $tmp = $this->tableMap->getBehaviors();
         $this->setColumnOption($tmp['sortable']['rank_column'], array('hide' => true));
         $this->setDefaultSort($tmp['sortable']['rank_column']);
         //$this->query->orderByRank();
     }
 }