예제 #1
0
<link rel="icon" type="image/png" href="http://png-3.findicons.com/files/icons/1579/devine/256/list.png" />
<?php 
if ($viewName === 'detail' || $viewName === 'edit') {
    printFieldsForDetail6($moduleName);
} elseif ($viewName === 'list') {
    printFieldsForList($moduleName);
} elseif ($viewName === 'search') {
    printFieldsForSearch($moduleName);
} elseif ($viewName === 'audit') {
    printFieldsAudit($moduleName);
} elseif ($viewName === 'import') {
    printFieldsImport($moduleName);
} elseif ($viewName === 'lang') {
    printFieldsForLang($moduleName);
} else {
    printFields($moduleName);
}
// Выводит все поля и соответствующие переводы
function printFieldsAudit($moduleName)
{
    $bean = BeanFactory::getBean($moduleName);
    //	$st_field = array("date_entered", "date_modified", "modified_user_id", "modified_by_name",
    //		"created_by","created_by_name","deleted","created_by_link","modified_user_link","team_count",
    //		"team_link","team_count_link","teams","team_sets","team_name");
    $st_field = array("date_entered", "date_modified", "modified_user_id", "modified_by_name", "created_by", "created_by_name", "deleted", "created_by_link", "modified_user_link", "team_count", "team_link", "team_count_link");
    echo '<table>';
    foreach ($bean->field_name_map as $field) {
        if (in_array($field['name'], $st_field)) {
            continue;
        }
        $label = !empty($field['vname']) ? translate($field['vname'], $moduleName) : ($label = '');
function fetchFieldsForId($id, $fields, $listFields = false, eZCLI $cli = null)
{

    $object = eZContentObject::fetchByNodeId($id, true);
    if ($object == null)
    {
        throw new Exception("Object with id {$id} doesn't exist");
    }
    $dataMap = $object->fetchDataMap();

    if ($listFields)
    {
        printFields($id, array_keys($dataMap), $cli);
    }
    $result = array(
        'Id' => $id
    );

    foreach ($fields as $field => $translation)
    {
        if (!array_key_exists($field, $dataMap)) {
            throw new Exception("Field {$field} is missing for object with id {$id}");
            break;
        }
        $fieldValue = $dataMap[$field];
        $result[$translation] = $fieldValue->toString();
    }
    return $result;
}