/** * Construct Table object from a Zend_Db_Table_Rowset * * @param Zend_Db_Table_Rowset_Abstract $rowset * @param string $tableName */ public function __construct(Zend_Db_Table_Rowset_Abstract $rowset, $tableName = null) { if($tableName == null) { $table = $rowset->getTable(); if($table !== null) { $tableName = $table->info('name'); } else { require_once "Zend/Test/PHPUnit/Db/Exception.php"; throw new Zend_Test_PHPUnit_Db_Exception( 'No table name was given to Rowset Table and table name cannot be infered from the table, '. 'because the rowset is disconnected from database.' ); } } $this->data = $rowset->toArray(); $columns = array(); if(isset($this->data[0]) > 0) { $columns = array_keys($this->data[0]); } else if($rowset->getTable() != null) { $columns = $rowset->getTable()->info('cols'); } $this->tableName = $tableName; $this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($this->tableName, $columns); }
/** * List access client tree. * * @param array $clients * @param Zend_Db_Table_Rowset_Abstract $accessClients * @return string */ public static function listClientsRecursively($clients, $accessClients) { $html = ''; if (!$clients || !count($clients)) { return $html; } $html .= '<ul class="accessTree">'; foreach ($clients as $_client) { if (Manager_Resource_Access::getInstance()->clientInAccess($_client['id'], $accessClients->toArray())) { $_checked = true; } else { $_checked = false; } $_clientHtml = '<li rel="' . $_client['id'] . '">'; $_clientHtml .= '<input type="checkbox"' . ($_checked ? ' checked="checked"' : '') . ' />'; $_clientHtml .= $_client['name']; if (isset($_client['children']) && count($_client['children'])) { $_clientHtml .= self::listClientsRecursively($_client['children'], $accessClients); } $_clientHtml .= '</li>'; $html .= $_clientHtml; } $html .= '</ul>'; return $html; }
public function achievsFormTrainings(Zend_Db_Table_Rowset_Abstract $trainings, array $groupsMethods, array $respons, array $months, array $groupsMethodsActual) { $methods = array(); foreach ($groupsMethods as $item) { $methods += $item; } $xhtml = array(); $xhtml[] = ' <div class="grid-head"> <table class="grid-head-table"> <thead> <tr> <th class="trains-field-num">№</th> <th class="trains-field-situation">Текущая ситуация<div>Current situation</div></th> <th class="trains-field-objective">Цель развития<div>Development objective</div></th> <th class="trains-field-method">Метод<div>Method</div></th> <th class="trains-field-responsible">Ответственный<div>Person in charge</div></th> <th class="trains-field-term">Срок<div>Timing</div></th> <th class="trains-field-result">Достижение цели плана развития<div>Individual development objective observable change</div></th> </tr> </thead> </table> </div> <div class="grid-body"> <table class="grid-body-table" id="trains"> <tbody> '; foreach ($trainings as $item) { $xhtml[] = $this->_rowTraining($item, $methods, $groupsMethods, $respons, $months, $groupsMethodsActual); } $xhtml[] = $this->_rowTraining($trainings->getTable()->createRow(), $methods, $groupsMethods, $respons, $months, $groupsMethodsActual); $xhtml[] = ' </tbody> </table> </div> <div class="grid-footer"> <table class="grid-footer-table"> <tbody> <tr> <td><div class="button" id="buttonAddTraining">Добавить цель проф. развития<br/> Add development objective</div></td> </tr> </tbody> </table> </div> '; return implode('', $xhtml); }
/** * List permissions * * @param Zend_Db_Table_Rowset_Abstract $permissions * @return string */ public static function listPermissions($permissions) { $html = self::HTML_DEFAULT_EMPTY; if ($permissions && $permissions->count()) { $html .= '<table class="table table-striped table-bordered table-condensed">'; $html .= '<thead><tr><th></th><th class="text-center">Name</th><th></th></tr></thead>'; $html .= '<tbody>'; foreach ($permissions as $_p) { $html .= '<tr rel="' . $_p->id . '" class="noClickThrough">'; $html .= '<td class="role-permission"><input type="checkbox" value="' . $_p->id . '" disabled /></td>'; $html .= '<td class="permission-name">' . $_p->name . '</td>'; $html .= '<td><div class="pull-right"><button type="button" class="btn btn-primary edit-permission" rel="' . $_p->id . '" details=\'' . Zend_Json::encode($_p->toArray()) . '\'>Details</button>'; $html .= '</tr>'; } $html .= '</tbody>'; $html .= '</table>'; } return $html; }
/** * moveSubtree * @param integer $intNodeId * @param integer $intDestination * @param integer $intDestinationDepth * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ private function moveSubtree($intNodeId, $intDestination, $intDestinationDepth) { try { $this->intNodeId = $intNodeId; $this->loadNodeData(); if ($this->objNodeData instanceof Zend_Db_Table_Rowset_Abstract && count($this->objNodeData) > 0) { $arrNode = $this->objNodeData->current()->toArray(); $intTreeSize = $arrNode[$this->strDBFRgt] - $arrNode[$this->strDBFLft] + 1; $this->shiftLRValues($intDestination, $intTreeSize); if ($arrNode[$this->strDBFLft] >= $intDestination) { $arrNode[$this->strDBFLft] += $intTreeSize; $arrNode[$this->strDBFRgt] += $intTreeSize; } $intDepthDiff = $intDestinationDepth - $arrNode[$this->strDBFDepth]; $this->shiftLRRange($arrNode[$this->strDBFLft], $arrNode[$this->strDBFRgt], $intDestination - $arrNode[$this->strDBFLft], $intDepthDiff); $this->shiftLRValues($arrNode[$this->strDBFRgt] + 1, -$intTreeSize); } } catch (Exception $exc) { $this->core->logger->err($exc); } }
/** * Returns all junction table data as an array. * * Updates the $_data property with current row object values. * * @return array */ public function junctionRowsetToArray() { return $this->_junctionRowset->toArray(); }
public function achievsPrintTasks(Zend_Db_Table_Rowset_Abstract $tasks, array $ratings, $have_func, $rate_weights, $card, $rtg, $status_id) { $xhtml = array(); $func_tasks = array(); $plan = false; if ($status_id == 'NEW' || $status_id == 'PLN' || $status_id == 'CPN') { $plan = true; } $xhtml[] = ' <table class="table"> <thead> <tr> <th class="tasks-field-num">№</th> <th class="tasks-field-description">Бизнес-цель<div>Business objective</div></th> <th class="tasks-field-term">Срок<div>Timing</div></th> <th class="tasks-field-weight">Вес<div>Weight</div></th> <th class="tasks-field-note"></th> <th class="tasks-field-result">Достижение бизнес-цели<div>Business objective achievement</div></th> <th class="tasks-field-rating">Рейтинг<div>Rating</div></th> </tr> </thead> </table>'; if ($have_func > 0) { $xhtml[] = '<div class="tasks-type"><span class="translate_ratio"><table id="ratio_tab" width="480px"> <tr> <td width="360px">Соотношение веса - бизнес-цели / функциональные цели<br/> Weight ratio - business objectives / functional objectives </td><td width="10px" align="center"> = </td> <td width="50px" align="center"> <label id="ratio_mng">' . $card->ratio_mng . '</label> </td><td width="10px" align="center">/</td> <td width="50px" align="center"><label id="ratio_fnc">' . $card->ratio_fnc . '</label> </td> </tr> </table></span></div>'; } $xhtml[] = ' <div class="tasks-type">Бизнес-цели - <span class="translate_category_tasks">Business Objectives</span></div> <table class="table"> <tbody>'; $count = 0; $count_func = 0; foreach ($tasks as $item) { if ($item->is_personal == null) { if ($item->is_functional == 1) { $func_tasks[] = $this->_rowTask($item, $ratings, ++$count_func); } else { $xhtml[] = $this->_rowTask($item, $ratings, ++$count); } } } if ($plan) { $newRow = $tasks->getTable()->createRow(); for ($i = 0; $i < 6; $i++) { $xhtml[] = $this->_rowTask($newRow, $ratings, ++$count); } } $xhtml[] = ' </tbody> </table>'; if ($have_func > 0) { $xhtml[] = ' <div class="tasks-type">Функциональные бизнес-цели - <span class="translate_category_tasks">Functional Business Objectives</span></div> <table class="table"> <tbody> '; $xhtml[] = implode('', $func_tasks); if ($plan) { $newRow = $tasks->getTable()->createRow(); for ($i = 0; $i < 6; $i++) { $xhtml[] = $this->_rowTask($newRow, $ratings, ++$count_func); } } $xhtml[] = ' </tbody> </table>'; } $xhtml[] = '</div> <div class="grid-footer"> <table class="grid-footer-table"> <tbody>'; if ($have_func > 0) { $xhtml[] = '<tr height="60px"> <td colspan="3" style="border-bottom:1px #666666 solid" valign="top" > <span class="translate_func_comment">Комментарии функционального руководителя - Functional Manager\'s comment</br></span> <div class="func_div" id="func_div">' . $card->fnc_comment . '</div> </td> <th class="tasks-field-rating-total" style="border-bottom:1px #666666 solid">Функциональный рейтинг:<br/>Functional rating:</th> <td class="field-rating tasks-field-rating-total" id="fieldRatingFunc" style="border-bottom:1px #666666 solid"> <div>' . $ratings[$card->rtg_func_id] . '</div> </td> </tr> <tr>'; } $xhtml[] = ' <tr> <td width="20%"> Вычисленный рейтинг:<br/>Calculated rating: </td> <td width="5%">' . $this->CalculateWeights($tasks, $rate_weights, $card) . '</td> <td width="50%"> </td> <td width="20%">Итоговый рейтинг:<br/>Total rating:</td> <td width="5%">' . $rtg . '</td> </tr> </tbody> </table> </div> '; return implode('', $xhtml); }
/** * List page list for screenshot settings. * * @param Zend_Db_Table_Rowset_Abstract $pages * @return string */ public static function pageScreenshotSettings($pages, $title = "Use static screenshots in PDF", $key = 'screenshot_type') { $html = Functions_View::HTML_DEFAULT_EMPTY; if ($pages && $pages->count()) { $html .= '<table class="table table-striped">'; $html .= '<thead><tr>'; $html .= '<th><div class="checkbox" id="checkAll"></div> ' . $title . '</th>'; $html .= '<th>Portal Pages</th></tr></thead>'; $html .= '<tbody>'; foreach ($pages as $_page) { $html .= '<tr rel="' . $_page->id . '" class="noClickThrough">'; $html .= '<td><div class="checkbox ' . ($_page->{$key} == Repo_Page::SCREENSHOT_TYPE_STATIC ? 'checked' : '') . '"></div></td>'; $html .= '<td>' . $_page->name . '</td>'; $html .= '</tr>'; } $html .= '</tbody>'; $html .= '</table>'; } return $html; }
public function __construct(array $config) { parent::__construct($config); }
public function achievsFormPersonal(Zend_Db_Table_Rowset_Abstract $tasks, Zend_Db_Table_Rowset_Abstract $personalTrainings, Zend_Db_Table_Rowset_Abstract $personalCompetences, array $ratings, $rate_weights, $userRole, $card, $status_id, Rp_Db_Table_Rowset $competences) { $personal = 1; $xhtml = array(); $xhtml[] = ' <div class="grid-head"> <table class="grid-head-table"> <thead> <tr> <th class="tasks-field-num">' . $count_func . '№</th> <th class="tasks-field-description">Бизнес-цель<div>Business objective</div></th> <th class="tasks-field-term">Срок<div>Timing</div></th> <th class="tasks-field-weight">Вес (%)<div>Weight (%)</div></th> <th class="tasks-field-note"></th> <th class="tasks-field-result">Достижение бизнес-цели<div>Business objective achievement</div></th> <th class="tasks-field-rating">Рейтинг<div>Rating</div></th> </tr> </thead> </table> </div>'; $xhtml[] = '<div class="grid-body">'; // вывод целей руководителя для оценки сотрудником if ($status_id == 'RTG' || $status_id == 'CRG' || $status_id == 'CLS' || $status_id == 'PLN' || $status_id == 'CPN') { $xhtml[] = '<div class="tasks-type">Бизнес-цели (руководитель) - <span class="translate_category_tasks">Business Objectives (manager)</span></div> <table class="grid-body-table" id="managertasks"> <tbody>'; $count = 0; foreach ($tasks as $item) { if ($item->is_personal != 1) { $xhtml[] = $this->_rowManagerTask($item, $ratings, ++$count); } } $xhtml[] = '</tbody> </table>'; } $xhtml[] = '<div class="tasks-type">Бизнес-цели (сотрудник) - <span class="translate_category_tasks">Business Objectives (employee)</span></div> <table class="grid-body-table" id="personaltasks"> <tbody>'; $count = 0; foreach ($tasks as $item) { if ($item->is_personal == 1) { $xhtml[] = $this->_rowTask($item, $ratings, $personal, ++$count); } } $xhtml[] = $this->_rowTask($tasks->getTable()->createRow(), $ratings, $personal); $xhtml[] = ' </tbody> </table>'; $xhtml[] = '</div>'; $xhtml[] = ' <div class="grid-footer"> <table class="grid-footer-table"> <tbody> <tr> <td> <div class="button" id="buttonAddPersonalTask">Добавить бизнес-цель<br/> Add business objective</div> </td> </tr> </tbody> </table> </div>'; // [START] компетенции $competences = $competences->toArray(); $cardRtgCompetensId = $card->rtg_competens_id; $stands = array(); $addits = array(); $xhtml[] = ' <div class="grid-head"> <table class="grid-head-table"> <thead> <tr> <th class="compets-field-num">№</th> <th class="compets-field-name">Компетенция<div>Competence</div></th> <th class="compets-field-note"> </th> <th class="compets-field-result">Достижение по компетенции<div>Competence achievement</div></th> <th class="compets-field-rating">Рейтинг<div>Rating</div></th> </tr> </thead> </table> </div>'; $xhtml[] = '<div class="grid-body">'; $stands[] = ' <div class="compets-type">Корпоративные компетенции - <span class="translate_category_tasks">Corporate competences</span></div> <table class="grid-body-table" id="personalStandsCompets"> <tbody> '; $addits[] = ' <div class="compets-type">Компетенции группы должностей - <span class="translate_category_tasks">Job families competences</span></div> <table class="grid-body-table" id="personalAdditsCompets"> <tbody> '; foreach ($competences as $item) { if (!$item['disabled']) { if ($item['additional']) { $addits[] = $this->_rowCompetence($item, $ratings, $in_person); } else { $stands[] = $this->_rowCompetence($item, $ratings, $in_person); } } } $stands[] = ' </tbody> </table> '; $addits[] = ' </tbody> </table> '; $xhtml[] = implode('', $stands) . implode('', $addits); $xhtml[] = '</div>'; $xhtml[] = ' <div class="grid-footer"> <table class="grid-footer-table"> <tbody><tr><td> </td></tr></tbody> </table> </div> '; // [END] компетенции // [START] собственные компетенции if (count($personalCompetences) > 0) { foreach ($personalCompetences as $itemCompetence) { $xhtml[] = $this->getPersonalCompetences($itemCompetence, $ratings); break; } } else { $xhtml[] = $this->getPersonalCompetences($personalCompetences->getTable()->createRow(), $ratings); } if (count($personalTrainings) > 0) { foreach ($personalTrainings as $itemTraining) { $xhtml[] = $this->getPersonalTraining($itemTraining); break; } } else { $xhtml[] = $this->getPersonalTraining($personalTrainings->getTable()->createRow()); } $xhtml[] = $this->getEmployeeComment($card); //$xhtml[] ='</div>'; // $xhtml[] = ' // <div class="grid-footer"> // <table class="grid-footer-table"> // <tbody>'; // // $xhtml[] = ' <td><div class="button" id="buttonAddPersonalTask">Добавить бизнес-цель<br/> Add business objective</div></td> // // </tr> // </tbody> // </table> // </div> // '; // $xhtml = array(); // $stands = array(); // $addits = array(); // [END] собственные компетенции return implode('', $xhtml); }
public function achievsFormTasks(Zend_Db_Table_Rowset_Abstract $tasks, $have_func, array $ratings, $rate_weights, $cardRtgTasksId, $userRole, $card, $cardRtgFuncId) { $xhtml = array(); $func_tasks = array(); // временный буфер для функциональных целей $func = $userRole ? 1 : 0; $xhtml[] = ' <div class="grid-head"> <table class="grid-head-table"> <thead> <tr> <th class="tasks-field-num">' . $count_func . '№</th> <th class="tasks-field-description">Бизнес-цель<div>Business objective</div></th> <th class="tasks-field-term">Срок<div>Timing</div></th> <th class="tasks-field-weight">Вес (%)<div>Weight (%)</div></th> <th class="tasks-field-note"></th> <th class="tasks-field-result">Достижение бизнес-цели<div>Business objective achievement</div></th> <th class="tasks-field-rating">Рейтинг<div>Rating</div></th> </tr> </thead> </table> </div>'; if ($have_func > 0) { $xhtml[] = '<div class="grid-body" style="bottom:100px; height: expression(this.parentNode.offsetHeight - 137 + \'px\')">'; } else { $xhtml[] = '<div class="grid-body">'; } if ($have_func > 0) { $xhtml[] = '<div class="tasks-type"><span class="translate_ratio"><table id="ratio_tab" width="480px"> <tr> <td width="360px">Соотношение веса - бизнес-цели / функциональные цели<br/> Weight ratio - business objectives / functional objectives </td><td width="10px" align="center"> = </td> <td width="50px" align="center"> <label id="ratio_mng"></label><input align="left" id="ratio[ratio_mng]" name="ratio[ratio_mng]" type="text" value="' . $card->ratio_mng . '" size="2" /> </td><td width="10px" align="center">/</td> <td width="50px" align="center"><label id="ratio_fnc"></label><input align="left" id="ratio[ratio_fnc]" name="ratio[ratio_fnc]" type="text" value="' . $card->ratio_fnc . '" size="2" /> </td> </tr> </table></span></div>'; } $xhtml[] = '<div class="tasks-type">Бизнес-цели - <span class="translate_category_tasks">Business Objectives</span></div> <table class="grid-body-table" id="tasks"> <tbody>'; $count = 0; $count_func = 0; foreach ($tasks as $item) { if ($item->is_personal == null) { if ($item->is_functional == 1) { $func_tasks[] = $this->_rowTask($item, $ratings, 1, ++$count_func); } else { $xhtml[] = $this->_rowTask($item, $ratings, null, ++$count); } } } $xhtml[] = $this->_rowTask($tasks->getTable()->createRow(), $ratings, $func); $xhtml[] = '</tbody> </table>'; if ($have_func > 0) { $xhtml[] = ' <div class="tasks-type">Функциональные бизнес-цели - <span class="translate_category_tasks">Functional Business Objectives</span></div> <table class="grid-body-table" id="functasks"> <tbody> '; $xhtml[] = implode('', $func_tasks); $xhtml[] = $this->_rowTask($tasks->getTable()->createRow(), $ratings, $func); $xhtml[] = ' </tbody> </table> '; } $xhtml[] = '</div> <div class="grid-footer"> <table class="grid-footer-table"> <tbody>'; if ($have_func > 0) { $xhtml[] = '<tr height="60px"> <td colspan="3" style="border-bottom:1px #666666 solid" valign="top" > <span class="translate_func_comment">Комментарии функционального руководителя - Functional Manager\'s comment</br></span> <textarea name="comments[fnc_comment]" id="comments[fnc_comment]" class="func_comment">' . $card->fnc_comment . '</textarea> <div class="func_div" id="func_div">' . $card->fnc_comment . '</div> </td> <th class="tasks-field-rating-total" style="border-bottom:1px #666666 solid">Функциональный рейтинг:<br/>Functional rating:</th> <td class="field-rating tasks-field-rating-total" id="fieldRatingFunc" style="border-bottom:1px #666666 solid"> ' . $this->view->formSelect('ratings[rtg_func_id]', $cardRtgFuncId, null, $ratings) . ' <div>' . $ratings[$cardRtgFuncId] . '</div> </td> </tr>'; } $xhtml[] = ' <tr> <td><div class="button" id="buttonAddTask">Добавить бизнес-цель<br/> Add business objective</div></td> <th class="tasks-field-rating-total">Вычисленный рейтинг:<br/>Calculated rating:</th> <td class="field-rating tasks-field-rating-total"><div>' . $this->CalculateWeights($tasks, $rate_weights, $card) . '</div> <input id="sum_tasks" type="hidden" value="' . $this->CalculateWeights($tasks, $rate_weights, $card) . '" /></td> <th class="tasks-field-rating-total">Итоговый рейтинг:<br/>Total rating:</th> <td class="field-rating tasks-field-rating-total" id="fieldRatingTasks"> ' . $this->view->formSelect('ratings[rtg_tasks_id]', $cardRtgTasksId, null, $ratings) . ' <div>' . $ratings[$cardRtgTasksId] . '</div> <input id="rtg_tasks" type="hidden" value="" /> </td> </tr> </tbody> </table> </div> '; return implode('', $xhtml); }