/** * A custom method within the Plugin to generate the content * * @return string : HTML */ function generateGitBranchBlock() { $output = ''; $do_user_git = new UserGitrepo(); $git_repo = $do_user_git->CheckGitProjectExist($_SESSION["do_project"]->idproject); if (is_array($git_repo)) { include_once 'plugin/Git/class/Git.class.php'; $repo_path = "plugin/Git/repos/"; //$output .= '<br />'; $e_del_gitrepo = new Event("UserGitrepo->eventSelfDelProjectGitRepo"); $e_del_gitrepo->addParam("goto", "Project/" . $_SESSION["do_project"]->idproject); $e_del_gitrepo->addParam("idgit_project", $git_repo["idgit_project"]); $output .= '<div id="templt" class="co_worker_item co_worker_desc">'; $output .= '<div style="position: relative;">'; //$output .= '<b>Repository Name : '.$git_repo['git_repo'].'<br /></b>'; $idproject_task = (int) $_GET['idprojecttask']; $repo_name = $git_repo['git_repo']; $folder = "{$repo_path}" . "{$repo_name}"; if (is_dir($folder)) { $repo = Git::open($folder); $branch_name = $repo->branchlist($idproject_task); $branch_name = split(' ', $branch_name); //echo'<pre>';print_r($branch_name);echo'</pre>'; $size = sizeof($branch_name); for ($i = 1; $i < $size; $i++) { $branch_title = split('/', $branch_name[$i]); //echo'<pre>';print_r($branch_title);echo'</pre>'; $b_size = sizeof($branch_title); $b_name = split(' ', $branch_title[$b_size - 1]); $br_name .= $b_name[0] . '<br />'; } if (!empty($br_name)) { $output .= _('Currently The Following Git branches are associated with this Task <br />'); //$output .= '<br />Branches assoicated with current task are :<br />'; $output .= '<b>' . $br_name . '</b>'; } else { $output .= _('No Git branches found which are associated with this Task <br />'); } } else { $output .= _('Invalid Respository, Missing git repository in the plugin/Git/repos/' . $repo_name . ', Please check and try again <br />'); } $output .= '</div></div>'; } else { $output .= 'No Git Repository is associated with this Project Task'; } return $output; }
/** * A custom method within the Plugin to generate the content * * @return string : HTML */ function generateAddGitRepositoryBlock() { $output = ''; $data = array(); $do_user_git = new UserGitrepo(); $git_repo = $do_user_git->CheckGitProjectExist($_SESSION["do_project"]->idproject); if (!is_array($git_repo)) { $data = $do_user_git->GetAllGitRepositoryForUser($_SESSION["do_User"]->iduser); if ($data != '') { $output .= _('Select the repository name from the list to add a git repository for this project.'); $output .= '<br />'; $e_git_repo = new Event("UserGitrepo->eventAddProjectGitRepo"); $e_git_repo->addParam("goto", "Project/" . $_SESSION["do_project"]->idproject); $e_git_repo->addParam("idproject", $_SESSION["do_project"]->idproject); $output .= $e_git_repo->getFormHeader(); $output .= $e_git_repo->getFormEvent(); $output .= $data; $output .= $e_git_repo->getFormFooter('Add this Git Repository'); } else { $path = $_SERVER['SERVER_NAME'] . '/Setting/Git/git_repo'; $output .= _('If you want to share git project repository, add Git Repository to your Ofuz account'); $output .= '<br /><br />'; $output .= '<a href="/Setting/Git/git_repo">'; $output .= _('Add Git-Repository'); $output .= '</a>'; } } else { $output .= _('Currently The Following Git Repository is associated with this Project'); $output .= '<br /><br />'; $e_del_gitrepo = new Event("UserGitrepo->eventSelfDelProjectGitRepo"); $e_del_gitrepo->addParam("goto", "Project/" . $_SESSION["do_project"]->idproject); $e_del_gitrepo->addParam("idgit_project", $git_repo["idgit_project"]); $output .= '<div id="templt" class="co_worker_item co_worker_desc">'; $output .= '<div style="position: relative;">'; $output .= '<b>' . $git_repo['git_repo'] . '</b>'; $img_del = '<img class="delete_icon_tag" border="0" width="14px" height="14px" src="/images/delete.gif">'; $output .= '<div width="15px" id="trashcan" class="deletenote" style="right:0;">' . $e_del_gitrepo->getLink($img_del, ' title="' . _('Remove') . '"') . '</div>'; $output .= '</div></div>'; } return $output; }
<?php /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/ // Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/ include_once 'config.php'; include_once 'plugin/Git/class/UserGitrepo.class.php'; include_once 'plugin/Git/class/Git.class.php'; $do_usergit = new UserGitrepo(); $do_usergit->getAll(); $rows = $do_usergit->getNumRows(); $repo_path = "plugin/Git/repos/"; $commitlog = array(); while ($do_usergit->fetch()) { $repo_name = $do_usergit->getData('git_repo'); $folder = "{$repo_path}" . "{$repo_name}"; if (is_dir($folder)) { $repo = Git::open($folder); echo '<pre>'; print_r($repo->log()); echo '</pre>'; $commitlog = $repo->log(); $commit_log = split('\\^', $commitlog); foreach ($commit_log as $commits) { if (!empty($commits)) { $commit_hash = split(";", $commits); $user = split("--", $commit_hash[1]); $user_email = $user[0]; $user_email = trim($user_email); $date = split(":", $user[1]); $date_log = $date[0];
<?php $iduser = $_SESSION['do_User']->iduser; $GitRepo = new UserGitrepo(); $data = $GitRepo->GetUserGitRepo($iduser); if (isset($_SESSION['msg'])) { ?> <div id="msg"><?php echo $_SESSION['msg']; ?> </div> <?php $_SESSION['msg'] = ''; unset($_SESSION['msg']); } if (is_array($data)) { ?> <table border=0 width="50%"> <tr> <td><b>Repository Name</b> </td> <td><b>Repository URL</b> </td> </tr> <?php foreach ($data as $key => $value) { echo "<tr><td>" . $key . "</td><td>" . $value . '</td></tr>'; } ?> </table> <?php } ?> <br /><br />