예제 #1
0
파일: licenses.php 프로젝트: kenjs/Goteo
 public static function process($action = 'list', $id = null, $filters = array())
 {
     // agrupaciones de mas a menos abertas
     $groups = Model\License::groups();
     // tipos de retorno para asociar
     $icons = Model\Icon::getAll('social');
     $errors = array();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         // objeto
         $license = new Model\License(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'url' => $_POST['url'], 'group' => $_POST['group'], 'order' => $_POST['order'], 'icons' => $_POST['icons']));
         if ($license->save($errors)) {
             switch ($_POST['action']) {
                 case 'add':
                     Message::Info(Text::get('admin-licenses-info-add'));
                     break;
                 case 'edit':
                     Message::Info(Text::get('admin-licenses-info-edit'));
                     // Evento Feed
                     $log = new Feed();
                     $log->populate('modificacion de licencia (admin)', '/admin/licenses', \vsprintf("El admin %s ha %s la licencia %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('project', $license->name))));
                     $log->doAdmin('admin');
                     unset($log);
                     break;
             }
         } else {
             Message::Error(implode('<br />', $errors));
             return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => $_POST['action'], 'license' => $license, 'icons' => $icons, 'groups' => $groups));
         }
     }
     switch ($action) {
         case 'up':
             Model\License::up($id);
             break;
         case 'down':
             Model\License::down($id);
             break;
         case 'add':
             $next = Model\License::next();
             return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => 'add', 'license' => (object) array('order' => $next, 'icons' => array()), 'icons' => $icons, 'groups' => $groups));
             break;
         case 'edit':
             $license = Model\License::get($id);
             return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => 'edit', 'license' => $license, 'icons' => $icons, 'groups' => $groups));
             break;
         case 'remove':
             //                Model\License::delete($id);
             break;
     }
     $licenses = Model\License::getAll($filters['icon'], $filters['group']);
     return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'list', 'licenses' => $licenses, 'filters' => $filters, 'groups' => $groups, 'icons' => $icons));
 }
예제 #2
0
파일: icon.php 프로젝트: isbkch/Goteo
 public static function getAll($group = '')
 {
     $values = array(':lang' => \LANG);
     $icons = array();
     $sql = "\n                SELECT\n                    icon.id as id,\n                    IFNULL(icon_lang.name, icon.name) as name,\n                    IFNULL(icon_lang.description, icon.description) as description,\n                    icon.group as `group`\n                FROM    icon\n                LEFT JOIN  icon_lang\n                    ON  icon_lang.id = icon.id\n                    AND icon_lang.lang = :lang\n                ";
     if ($group != '') {
         // de un grupo o de todos
         $sql .= " WHERE icon.group = :group OR icon.group IS NULL OR icon.group = ''";
         $values[':group'] = $group;
     }
     $sql .= " ORDER BY `order` ASC, name ASC";
     $query = static::query($sql, $values);
     foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $icon) {
         if ($group == 'social') {
             $icon->licenses = License::getAll($icon->id);
         }
         $icons[$icon->id] = $icon;
     }
     return $icons;
 }
예제 #3
0
파일: reward.php 프로젝트: kenjs/Goteo
 public static function licenses()
 {
     $list = array();
     $licenses = License::getAll();
     foreach ($licenses as $license) {
         $list[$license->id] = $license->name;
     }
     return $list;
 }
예제 #4
0
$project = $this['project'];
$personal = $this['personal'];
// cantidad de aporte
if (isset($_SESSION['invest-amount'])) {
    $amount = $_SESSION['invest-amount'];
    unset($_SESSION['invest-amount']);
} elseif (!empty($_GET['amount'])) {
    $amount = $_GET['amount'];
} else {
    $amount = 0;
}
$step = $this['step'];
$level = (int) $this['level'] ?: 3;
$worthcracy = Worth::getAll();
$licenses = array();
foreach (License::getAll() as $l) {
    $licenses[$l->id] = $l;
}
$action = $step == 'start' ? '/user/login' : '/invest/' . $project->id;
?>
<div class="widget project-invest project-invest-amount">
    <h<?php 
echo $level;
?>
 class="title"><?php 
echo Text::get('invest-amount');
?>
</h<?php 
echo $level;
?>
>