function task_rtask($args = array())
{
    if (!$args) {
        throw new Exception("Args missing");
    }
    $name = array_shift($args);
    $project = Project::findProject($name);
    $project->rtask(implode(" ", $args), new CliResponse());
}
 function doRollback()
 {
     $this->useForm('form');
     $form_date = array();
     $project = Project::findProject($this->request->get('id'));
     $this->view->set('project', $project);
     if (!$project->getHistory()) {
         $this->flashError("For project '{$project->getName()}' history is off!");
         $this->redirect(array('controller' => 'projects', 'action' => 'display'));
         return;
     }
     if ($this->request->hasPost()) {
         $form_date['new_current_ln'] = $this->request->get('new_current_ln');
         if (!$project->setCurrentLn($form_date['new_current_ln'])) {
             $this->flashError('Change not save!');
         } else {
             $this->flashMessage('Change save!');
         }
     }
     $dir_list = array();
     foreach ($project->getListHistory() as $value) {
         $dir_list[$value] = $value;
     }
     $this->view->set('dir_list', $dir_list);
     $this->setFormDatasource($form_date);
     foreach ($project->errors as $error) {
         $this->flashError($error);
     }
 }
Example #3
0
#!/usr/bin/env php
<?php 
if (!isset($argv[1])) {
    echo "Usage: sync.php <project>,[<project>,<project>...]\n";
    exit(1);
}
require_once dirname(__FILE__) . '/../setup.php';
require_once 'src/model/Project.class.php';
class CliResponse
{
    function notify($project, $cmd, $log)
    {
        static $cmds = array();
        if (!isset($cmds[$cmd])) {
            echo "{$cmd}\n";
            $cmds[$cmd] = 1;
        }
        echo $log;
    }
    function error($project, $log)
    {
        echo $log;
    }
}
$names = explode(",", $argv[1]);
foreach ($names as $name) {
    $project = Project::findProject($name);
    $project->sync(new CliResponse());
}
 public function getProjects()
 {
     $id = $_GET['id'];
     $project = Project::findProject($id);
     return View::make('projects_page')->with('project', $project)->with('id', $id);
 }