Project::Rename PHP Method

Rename() public method

public Rename ( )
    public function Rename()
    {
        $revised_array = array();
        foreach ($this->projects as $project => $data) {
            if ($data['path'] != $this->path) {
                $revised_array[] = array("name" => $data['name'], "path" => $data['path']);
            }
        }
        $revised_array[] = $this->projects[] = array("name" => $_GET['project_name'], "path" => $this->path);
        // Save array back to JSON
        saveJSON('projects.php', $revised_array);
        // Response
        echo formatJSEND("success", null);
    }

Usage Example

Example #1
0
        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
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'delete') {
    if (checkAccess()) {
        $Project->path = $_GET['project_path'];
        $Project->Delete();
    }
}
//////////////////////////////////////////////////////////////////
// Return Current
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'current') {
    if (isset($_SESSION['project'])) {