コード例 #1
0
 public function Edit($pa_values = null, $pa_options = null)
 {
     $o_result_context = new ResultContext($this->request, 'ca_relationship_types', 'basic_search');
     $va_cur_result = $o_result_context->getResultList();
     $vn_id = $this->request->getParameter('type_id', pInteger);
     $vn_parent_id = $this->request->getParameter('parent_id', pInteger);
     // If we're creating a new record we'll need to establish the table_num
     // from the parent (there's always a parent)
     if (!$vn_id) {
         $t_parent = new ca_relationship_types($vn_parent_id);
         if (!$t_parent->getPrimaryKey()) {
             $this->postError(1230, _t("Invalid parent"), "RelationshipTypeEditorController->Edit()");
             return;
         }
         $this->request->setParameter('table_num', $t_parent->get('table_num'));
     }
     if (!is_array($va_cur_result) || !in_array($vn_id, $va_cur_result)) {
         //
         // Set "results list" navigation to all types in the same level as the currently selected type
         //
         $t_instance = new ca_relationship_types();
         if (is_array($va_siblings = $t_instance->getHierarchySiblings($this->request->getParameter('type_id', pInteger), array('idsOnly' => true)))) {
             $o_result_context->setResultList($va_siblings);
             $o_result_context->saveContext();
         }
     }
     parent::Edit();
 }