本文整理汇总了PHP中AMA_DataHandler::course_has_instances方法的典型用法代码示例。如果您正苦于以下问题:PHP AMA_DataHandler::course_has_instances方法的具体用法?PHP AMA_DataHandler::course_has_instances怎么用?PHP AMA_DataHandler::course_has_instances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMA_DataHandler
的用法示例。
在下文中一共展示了AMA_DataHandler::course_has_instances方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translateFN
function set_init($set_ha)
{
global $debug;
$add_or_upgrade_ok = false;
if (!is_array($set_ha)) {
$this->initerror = translateFN("Dati di inizializzazione in formato non corretto");
return false;
} else {
$this->livello = 0;
$this->livellolink = 0;
$this->livellomedia = 0;
$this->set_ha['id_author'] = $set_ha['id_author'];
$this->set_ha['id_course'] = $set_ha['id_course'];
$this->set_ha['xml_file'] = $set_ha['xml_file'];
$this->set_ha['media_path'] = $set_ha['media_path'];
}
// verifying if course has instances already started
$id_course = $this->set_ha['id_course'];
$dh = new AMA_DataHandler();
// inserimento dati nel database
$instances = $dh->course_has_instances($id_course);
if ($instances) {
$field_list_ar = array('data_inizio_previsto', 'data_inizio');
$today = time();
$clause = "id_corso = {$id_course} and data_inizio >= {$today}";
$course_instancesAr = $dh->course_instance_find_list($field_list_ar, $clause);
// or else a loop on course_instance_get($id) ...
// mydebug(__LINE__,__FILE__,$course_instancesAr);
if (count($course_instancesAr)) {
// Removing all course data
$res = $dh->remove_course_content($id_course);
// $debug=1; mydebug(__LINE__,__FILE__,$res);$debug=0;
if (AMA_DataHandler::isError($res)) {
// ch'aggi'a fa'?
$this->initerror = translateFN("Impossibile rimuovere il corso con id:") . $id_course;
$add_or_upgrade_ok = false;
// print $res->$message;
} else {
$add_or_upgrade_ok = true;
}
} else {
$add_or_upgrade_ok = true;
}
} else {
$add_or_upgrade_ok = true;
}
if ($add_or_upgrade_ok) {
if (!$this->set_ha['id_author']) {
$this->initerror = translateFN("Impossibile trovare l'autore con id:") . $id_author;
return false;
} elseif (!$this->set_ha['id_course']) {
$this->initerror = translateFN("Impossibile trovare il corso con id:") . $id_course;
return false;
} elseif (@filetype($this->set_ha['xml_file']) != "file") {
$this->initerror = translateFN("Errore nel tipo di file");
return false;
} else {
return true;
}
} else {
return false;
}
}