protected function loadObjects() { parent::loadObjects(); if (($this->isPost() || $this->hasData()) && ($searchObj = $this->getPrimary()) instanceof CSD_Search && I2CE_FormStorage::getStorageMechanism($searchObj->getName()) instanceof I2CE_FormStorage_CSDSearch) { //this will populate "result" field $searchObj->setID("1"); //so it will populate if (($maxField = $searchObj->getField('max')) instanceof I2CE_FormField_INT) { if ($maxField->getValue() > 200) { $maxField->setValue(200); } } if (($entityIDField = $searchObj->getField('entityID')) instanceof I2CE_FormField_STRING_LINE) { list($form, $id) = array_pad(explode('|', $entityIDField->getValue(), 2), 2, ''); if ($id) { $entityIDField->setValue($id); } } $searchObj->populate(true); if (($matches = $searchObj->getField('matches')) instanceof I2CE_FormField_ASSOC_MAP_RESULTS && count($matches->getValue()) > 200) { $this->userMessage("To Many Results To Display. Please refine your search"); I2CE::raiseError("Too many results"); $this->bad_result = true; $matches->setValue(array()); if (($resultField = $searchObj->getField('result')) instanceof I2CE_FormField) { $resultField->setValue(''); } } } return true; }
/** * Create and load data for the objects used for this form. * * Create the list object and if this is a form submission load * the data from the form data. It determines the type based on the * {@link $type} member variable. */ protected function loadObjects() { if ($this->getAction() == 'remap') { I2CE::raiseError("Is RM"); return true; } else { if ($this->getAction() == 'view') { $listConfig = $this->getListConfig(); if (!($primaryFormName = $this->getPrimaryFormName())) { I2CE::raiseError("Primary form name mismatch " . $primaryFormName . ' != ' . $this->getPrimaryFormName()); return false; } if (!array_key_exists('form', $listConfig)) { return false; } if ($this->request_exists('id')) { $id = $this->request('id'); if (strpos($id, '|') === false) { I2CE::raiseError("Deprecated use of id variable"); $id = $primaryFormName . '|' . $id; } } else { $id = $primaryFormName . '|0'; } $obj = I2CE_FormFactory::instance()->createContainer($id); if (!$obj instanceof I2CE_List || $obj->getName() != $listConfig['form']) { I2CE::raiseError("Not list/incorrect list"); return false; } $ff = I2CE_FormFactory::instance(); if ($obj->getID() != '0' && !$ff->hasRecord($obj->getName(), $obj->getID())) { I2CE::raiseError("No record:" . $obj->getFormID()); $obj->cleanup(); return false; } $obj->populate(); $this->primaryObject = $obj; } else { if ($this->getAction() == 'edit') { parent::loadObjects(); } } } return true; }