Example #1
0
    $view->setContent($objectsDatas);
    $view->show();
}
//CHECKS objectId
if (!$objectId && !$fieldId) {
    CMS_grandFather::raiseError('Missing objectId to list in module ' . $codename);
    $view->setContent($objectsDatas);
    $view->show();
} elseif (!$objectId && $fieldId) {
    $objectId = CMS_poly_object_catalog::getObjectIDForField($fieldId);
}
//load current object definition
$object = CMS_poly_object_catalog::getObjectDefinition($objectId);
if (!$object->hasError()) {
    $conditions = $query ? array('keywords' => $query) : array();
    $objectsNames = CMS_poly_object_catalog::getListOfNamesForObject($objectId, false, $conditions);
    if (is_array($objectsNames) && $objectsNames) {
        $objectsDatas['objects'][] = array('id' => '0', 'label' => ' ');
        foreach ($objectsNames as $id => $label) {
            if (!$removeIds || !in_array($id, $removeIds)) {
                $objectsDatas['objects'][] = array('id' => $id, 'label' => io::decodeEntities($label));
            }
        }
    } else {
        $objectsDatas['objects'][] = array('id' => '0', 'label' => $cms_language->getMessage(MESSAGE_PAGE_NO_ITEM, false, MOD_POLYMOD_CODENAME));
    }
} else {
    $objectsDatas['objects'][] = array('id' => '0', 'label' => $cms_language->getMessage(MESSAGE_PAGE_ITEM_NON_EXISTENT, false, MOD_POLYMOD_CODENAME));
}
$view->setContent($objectsDatas);
$view->show();
 /**
  * Return a list of all objects names of given type
  *
  * @param boolean $public are the needed datas public ? (default false)
  * @param array $searchConditions, search conditions to add. Format : array(conditionType => conditionValue)
  * @return array(integer objectID => string objectName)
  * @access public
  * @static
  */
 function getListOfNamesForObject($public = false, $searchConditions = array())
 {
     return CMS_poly_object_catalog::getListOfNamesForObject(io::substr($this->_field->getValue('type'), 6), $public, $searchConditions);
 }
Example #3
0
 /**
  * Return a list of all objects names of given type
  *
  * @param boolean $public are the needed datas public ? (default false)
  * @param array $searchConditions, search conditions to add. Format : array(conditionType => conditionValue)
  * @return array(integer objectID => string objectName)
  * @access public
  * @static
  */
 function getListOfNamesForObject($public = false, $searchConditions = array())
 {
     return CMS_poly_object_catalog::getListOfNamesForObject($this->_objectID, $public, $searchConditions);
 }