Create() public method

public Create ( )
Example #1
0
 public function testCreateProject()
 {
     $client = Client::GetClient(2);
     $project = Project::Create('Gatuanyaga Phase II', 'Gatu, Kiambu', '24/08/2015', 'Description', $client->id);
     //create project account, a sub account of client (debtor account)
     $qid1 = '252';
     $qid2 = '254';
     $project->importQuote($qid1);
     $project->importQuote($qid2);
     $project->authorize();
     $this->assertInstanceOf('Project', $project);
     $this->assertTrue(count($project->quotations) == 2);
 }
Example #2
0
 public function createProject($name, $location, $descr, $clientid, $quotes)
 {
     $project = Project::Create($name, $location, $descr, $clientid, $quotes);
     foreach ($quotes as $qid) {
         $project->importQuote($qid);
     }
     if ($project->authorize()) {
         echo 1;
     } else {
         echo 0;
     }
 }
Example #3
0
// Create Project
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'create') {
    if (checkAccess()) {
        $Project->name = $_GET['project_name'];
        if ($_GET['project_path'] != '') {
            $Project->path = $_GET['project_path'];
        } else {
            $Project->path = $_GET['project_name'];
        }
        // Git Clone?
        if (!empty($_GET['git_repo'])) {
            $Project->gitrepo = $_GET['git_repo'];
            $Project->gitbranch = $_GET['git_branch'];
        }
        $Project->Create();
    }
}
//////////////////////////////////////////////////////////////////
// Rename Project
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'rename') {
    if (!checkPath($_GET['project_path'])) {
        die(formatJSEND("error", "No Access"));
    }
    $Project->path = $_GET['project_path'];
    $Project->Rename();
}
//////////////////////////////////////////////////////////////////
// Delete Project
//////////////////////////////////////////////////////////////////
<?php

include_once dirname(__FILE__) . "/project-settings.php";
include_once constant("PATH_TO_FRAMEWORK") . "/base/Base.php";
$mysql = new MySQLProvider("localhost", PROJECT_MYSQL_USERNAME, PROJECT_MYSQL_PASSWORD, PROJECT_MYSQL_DATABASE);
// create the project
$project = Project::Create(constant("PROJECT_NAME"), constant("PROJECT_TITLE"), constant("PROJECT_AUTHOR"), constant("PROJECT_DIR"), constant("PROJECT_TIMEZONE"));
// timezone
$application = Application::getInstance();
$project->setQueriedDataProvider($mysql);
$application->Start();
$mysql->connect();
SurogateDataDriver::SetRealDataDriver(new MySQLDataDriver());
include_once dirname(__FILE__) . "/functions.php";