/**
  * 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;
 }