Пример #1
0
// format dates
$df = $AppUI->getPref('SHDATEFORMAT');
$lasttested = intval($obj->unittest_lasttested) ? new CDate($obj->unittest_lasttested) : new CDate();
// load the record data in case of that this script is used to edit the quote qith unittest_id (transmitted via GET)
if (!$obj->load($unittest_id, false) && $unittest_id > 0) {
    // show some error messages using the dPFramework if loadOperation failed
    // these error messages are nicely integrated with the frontend of dP
    // use detailed error messages as often as possible
    $AppUI->setMsg('Testing');
    $AppUI->setMsg("invalidID", UI_MSG_ERROR, true);
    $AppUI->redirect();
    // go back to the calling location
}
// check if this record has dependancies to prevent deletion
$msg = '';
$canDelete = $obj->canDelete($msg, $unittest_id);
// this is not relevant for CTesting objects
// this code is shown for demonstration purposes
// setup the title block
// Fill the title block either with 'Edit' or with 'New' depending on if unittest_id has been transmitted via GET or is empty
$ttl = "Perform Test";
$titleBlock = new CTitleBlock($ttl, 'testing.png', $m, "{$m}.{$a}");
// also have a breadcrumb here
// breadcrumbs facilitate the navigation within dP as they did for haensel and gretel in the identically named fairytale
$titleBlock->addCrumb("?m=testing", "Unit Testing home");
if ($canEdit && $unittest_id > 0) {
    $titleBlock->addCrumbDelete('delete test', $canDelete, $msg);
    // please notice that the text 'delete test' will be automatically
    // prepared for translation by the dPFramework
}
$titleBlock->show();