Esempio n. 1
0
            /**
             * need to set the added extra arr
             * state to saved and to give it the returned id
             */
            $extraTableProperty = 'tbl_' . $extraTableClass;
            // $lastInsertKey = count($editUserObj->$extraTableProperty)-1;
            /**
             * WEIRD STUFF:  NEED TO ACCESS OBJECT THIS WAY OTHERWISE WON'T WORK
             */
            $extraTableKeyProperty = $extraTableClass::getKeyProperty();
            $temp1 = $editUserObj->{$extraTableProperty};
            // 			$temp =  $temp1[$lastInsertKey];
            $temp = $temp1[$updatedElementKey];
            $temp->{$extraTableKeyProperty} = $result;
            $temp->setSaveState(true);
            $myhtml = UserExtraModuleHtmlLib::extraObjectRow($temp);
            /**
             * Set the session user to the saved one if it's not
             * a switcher, that is not saving its own profile
             */
            if ($userObj->getType() != AMA_TYPE_SWITCHER) {
                $_SESSION['sess_userObj'] = $editUserObj;
            }
            $retArray = array("status" => "OK", "title" => $title, "msg" => translateFN("Scheda salvata"), "extraID" => $result, "html" => $myhtml);
        } else {
            $retArray = array("status" => "ERROR", "title" => $title, "msg" => translateFN("Errore nel salvataggio"));
        }
    } else {
        $retArray = array("status" => "ERROR", "title" => $title, "msg" => translateFN("I dati non sono validi"));
    }
} else {
Esempio n. 2
0
     $divButton->addChild($hideButton);
     $objProperty = 'tbl_' . $extraTableName;
     // create a div to wrap up all the rows of the array tbl_educationTrainig
     $container = CDOMElement::create('div', 'class:extraRowsContainer,id:container_' . $extraTableName);
     // if have 3 or more rows, add the new and discard buttons on top also
     if (count($editUserObj->{$objProperty}) >= 3) {
         $divButton->setAttribute('class', $divButton->getAttribute('class') . ' top');
         $container->addChild(new CText($divButton->getHtml()));
         // reset the button class by removing top
         $divButton->setAttribute('class', str_ireplace(' top', '', $divButton->getAttribute('class')));
     }
     if (count($editUserObj->{$objProperty}) > 0) {
         foreach ($editUserObj->{$objProperty} as $num => $aElement) {
             $keyFieldName = $aElement::getKeyProperty();
             $keyFieldVal = $aElement->{$keyFieldName};
             $container->addChild(new CText(UserExtraModuleHtmlLib::extraObjectRow($aElement)));
         }
     }
     // in these cases the form is added here
     $container->addChild(CDOMElement::create('div', 'class:clearfix'));
     $container->addChild(new CText($form->render()));
     // unset the form that's going to be userd in next iteration
     unset($form);
     $container->addChild(CDOMElement::create('div', 'class:clearfix'));
     // add the new and discard buttons after the container
     $divButton->setAttribute('class', $divButton->getAttribute('class') . ' bottom');
     $container->addChild(new CText($divButton->getHtml()));
 } else {
     /**
      * place the form in the tab
      */