/** * @param DataAccessResult $dar * @return GitRepository */ private function getRepositoryFromDar(DataAccessResult $dar) { if ($dar->rowCount() == 1) { return $this->instanciateFromRow($dar->getRow()); } return null; }
/** * Display the user search result * * @param DataAccessResult $res result of the user search * * @return String */ private function displayUserResultTable($res) { $userHelper = UserHelper::instance(); $hp = Codendi_HTMLPurifier::instance(); $nbCols = 3; if ($res->rowCount()) { $output = '<table style="width: 100%"><tr>'; $i = 0; foreach ($res as $data) { if ($i++ % $nbCols == 0) { $output .= '</tr><tr>'; } $action = 'add'; $background = 'eee'; if ($data['is_on']) { $action = 'remove'; $background = 'dcf7c4'; } $output .= '<td width="' . round(100 / $nbCols) . '%">'; $output .= '<div style="border:1px solid #CCC; background: #' . $background . '; padding:10px 5px; position:relative">'; $output .= '<table width="100%"><tr><td><a href="/users/' . $hp->purify($data['user_name']) . '/">' . $hp->purify($userHelper->getDisplayName($data['user_name'], $data['realname'])) . '</a></td>'; $output .= '<td style="text-align:right;">'; $output .= $this->project_admin_bullet_user_content($data['user_id'], $action); $output .= '</td></tr></table>'; $output .= '<div style="color:#666; ">' . $data['email'] . '</div>'; $output .= '</div>'; $output .= '</td>'; } while ($i++ % $nbCols != 0) { $output .= '<td width="' . round(100 / $nbCols) . '%"></td>'; } $output .= '</tr></table>'; } else { $output = 'No user match'; } return $output; }
/** * @param DataAccessResult $dar * @return GitRepository */ private function getRepositoryFromDar(DataAccessResult $dar) { $repository = null; if ($dar->rowCount() == 1) { $repository = new GitRepository(); $this->dao->hydrateRepositoryObject($repository, $dar->getRow()); } return $repository; }
/** * Build the top list of link for the 2 ways (links and back_links). * * @param String $way Either 'links' or 'back_links' * @param String $sql The SQL to get the links * @return String */ function getLinksByLinkType($way, DataAccessResult $dar) { $html = ''; if ($dar->rowCount() > 0) { $linkTypeCmdId = 'plugin_project_links_type_' . $way; $cssClass = Toggler::getClassName($linkTypeCmdId); $titleSpan = "<span id=\"" . $linkTypeCmdId . "\" class=\"" . $cssClass . "\">" . $GLOBALS['Language']->getText('plugin_plinks', $way) . '</span>'; $html .= "<li>" . $titleSpan; $links = $this->getLinks($way, $dar); if ($links != '') { $html .= "\n"; $html .= " <ul>\n"; $html .= $links; $html .= " </ul>\n"; } $html .= "</li>\n"; } return $html; }