Пример #1
0
     $associated_authors = explode(",", $_POST["associated_author"]);
     foreach ($associated_authors as $contact_order => $proxy_id) {
         if ($proxy_id = clean_input($proxy_id, array("trim", "int"))) {
             $PROCESSED["associated_authors"][(int) $contact_order] = $proxy_id;
         }
     }
 }
 /**
  * The current evaluation author must be in the author list.
  */
 if (!in_array($ENTRADA_USER->getActiveId(), $PROCESSED["associated_authors"])) {
     array_unshift($PROCESSED["associated_authors"], $ENTRADA_USER->getActiveId());
 }
 $authors_with_duplicates = array();
 foreach ($PROCESSED["associated_authors"] as $author) {
     $evaluation_forms = Models_Evaluation_Form::fetchAllByAuthorAndTitle($author, $PROCESSED["form_title"]);
     if ($evaluation_forms) {
         $authors_with_duplicates[] = $author;
     }
 }
 if (count($authors_with_duplicates) >= 1) {
     if (count($authors_with_duplicates) == 1) {
         if ($authors_with_duplicates[0] == $ENTRADA_USER->getActiveId()) {
             add_error("The <strong>Form Title</strong> must be unique for each author. Please ensure that you use a form name which you are not an author for already.<br /><br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.");
         } else {
             $author_name = get_account_data("wholename", $authors_with_duplicates[0]);
             add_error("The <strong>Form Title</strong> must be unique for each author. Please ensure that you use a form name which <strong>" . html_encode($author_name) . "</strong> is not an author for already.<br /><br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.");
         }
     } else {
         $error_string = "The <strong>Form Title</strong> must be unique for each author.<br /><br /> The following list of users are already an author on another form with the same name: <br />\n<ul class=\"menu\">\n";
         foreach ($authors_with_duplicates as $author) {
Пример #2
0
  * Required field "form_title" / Form Title.
  */
 if (isset($_POST["form_title"]) && ($tmp_input = clean_input($_POST["form_title"], array("notags", "trim")))) {
     $PROCESSED["organisation_id"] = $ENTRADA_USER->getActiveOrganisation();
     $PROCESSED["target_id"] = $form_record["target_id"];
     $PROCESSED["form_title"] = $tmp_input;
     $PROCESSED["form_description"] = $form_record["form_description"];
     $PROCESSED["form_active"] = 1;
     $PROCESSED["updated_date"] = time();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     $query = "SELECT * FROM `evaluation_form_contacts`\n\t\t\t\t\t\t\t\t\tWHERE `eform_id` = " . $db->qstr($FORM_ID);
     $evaluation_form_contacts = $db->GetAll($query);
     $authors_with_duplicates = array();
     foreach ($evaluation_form_contacts as $contact) {
         if ($contact["contact_role"] == "author") {
             $evaluation_forms = Models_Evaluation_Form::fetchAllByAuthorAndTitle($contact["proxy_id"], $PROCESSED["form_title"]);
             if ($evaluation_forms) {
                 $authors_with_duplicates[] = $contact["proxy_id"];
             }
         }
     }
     if (count($authors_with_duplicates) >= 1) {
         if (count($authors_with_duplicates) == 1) {
             if ($authors_with_duplicates[0] == $ENTRADA_USER->getActiveId()) {
                 add_error("The <strong>Form Title</strong> must be unique for each author. Please ensure that you use a form name which you are not an author for already.<br /><br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.");
             } else {
                 $author_name = get_account_data("wholename", $authors_with_duplicates[0]);
                 add_error("The <strong>Form Title</strong> must be unique for each author. Please ensure that you use a form name which <strong>" . html_encode($author_name) . "</strong> is not an author for already.<br /><br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.");
             }
         } else {
             $error_string = "The <strong>Form Title</strong> must be unique for each author.<br /><br /> The following list of authors are already authors on another form with the same name: <br />\n<ul class=\"menu\">\n";