当前位置: 首页>>代码示例>>PHP>>正文


PHP CommonFunctions::is_issn_valid方法代码示例

本文整理汇总了PHP中CommonFunctions::is_issn_valid方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::is_issn_valid方法的具体用法?PHP CommonFunctions::is_issn_valid怎么用?PHP CommonFunctions::is_issn_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonFunctions的用法示例。


在下文中一共展示了CommonFunctions::is_issn_valid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editAction

 public function editAction()
 {
     $this->view->messages = $this->_flashMessenger->getMessages();
     $this->_helper->layout->disableLayout();
     $id = $this->_request->getParam('id', 0);
     if ($id > 0 && $this->modelBooks->isExist($id)) {
         $formData = array();
         $formErrors = array();
         $formDataSave = array();
         $bookInfo = $this->modelBooks->fetchRow('id=' . $id);
         $formData = $bookInfo->toArray();
         $formData['book_genre'] = $formData['product_type'];
         if ($this->getRequest()->isPost()) {
             $formDataSave = $this->getRequest()->getPost();
             if (!empty($formDataSave['updatebook']) && $formDataSave['updatebook'] == 'Edit Book') {
                 if (!isset($formDataSave['category']) || trim($formDataSave['category']) == "") {
                     $formErrors['category'] = "Please select category";
                 }
                 if (!isset($formDataSave['book_genre']) || trim($formDataSave['book_genre']) == "") {
                     $formErrors['book_genre'] = "Please select book type ";
                 }
                 if (isset($formDataSave['author']) && trim($formDataSave['author']) == "") {
                     $formErrors['author'] = "Please select author";
                 }
                 if (!isset($formDataSave['title']) || trim($formDataSave['title']) == "") {
                     $formErrors['title'] = "Please enter/select title or brand";
                 }
                 if (isset($formDataSave['isbn_number']) && trim($formDataSave['isbn_number']) == "") {
                     $formErrors['isbn_number'] = "Please enter isbn number";
                 } elseif (isset($formDataSave['issn_number']) && trim($formDataSave['issn_number']) == "") {
                     $formErrors['issn_number'] = "Please enter issn number 1";
                 }
                 if (!isset($formDataSave['publisher']) || trim($formDataSave['publisher']) == "") {
                     $formErrors['publisher'] = "Please enter publisher name";
                 }
                 if (isset($formDataSave['total_pages']) && trim($formDataSave['total_pages']) == "") {
                     $formErrors['total_pages'] = "Please enter total pages";
                 } else {
                     $formData['total_pages'] = 0;
                 }
                 if (!isset($formDataSave['description']) || trim($formDataSave['description']) == "") {
                     $formErrors['description'] = "Please enter description";
                 }
                 if ($this->modelBooks->isExist("title='{$formDataSave['title']}' AND id<>'{$id}'")) {
                     if (!array_key_exists('title', $formErrors)) {
                         $formData['title'] = $formDataSave['title'];
                         $formErrors['title'] = "Publication already exist";
                     }
                 }
                 if (isset($formDataSave['isbn_number']) && !empty($formDataSave['isbn_number'])) {
                     if (!CommonFunctions::is_isbn_13_valid($formDataSave['isbn_number'])) {
                         if (!array_key_exists('isbn_number', $formErrors)) {
                             $formErrors['isbn_number'] = "Please enter a valid ISBN number format";
                         }
                     }
                 } elseif (isset($formDataSave['issn_number']) && !empty($formDataSave['issn_number'])) {
                     if (!CommonFunctions::is_issn_valid($formDataSave['issn_number'])) {
                         if (!array_key_exists('issn_number', $formErrors)) {
                             $formErrors['issn_number'] = "Please enter a valid ISSN number format";
                         }
                     }
                 }
                 if (isset($formDataSave['isbn_number']) && !empty($formDataSave['isbn_number']) && $this->modelBooks->isExist("isbn_number='{$formDataSave['isbn_number']}' AND id<>'{$id}'")) {
                     if (!array_key_exists('isbn_number', $formErrors)) {
                         $formData['isbn_number'] = $formDataSave['isbn_number'];
                         $formErrors['isbn_number'] = "ISBN already exist";
                     }
                 } elseif (isset($formDataSave['issn_number']) && !empty($formDataSave['issn_number']) && $this->modelBooks->isExist("isbn_number='{$formDataSave['issn_number']}' AND id<>'{$id}'")) {
                     if (!array_key_exists('issn_number', $formErrors)) {
                         $formData['isbn_number'] = $formDataSave['issn_number'];
                         $formErrors['issn_number'] = "ISSN already exist";
                     }
                 }
                 if (count($formErrors) == 0) {
                     $publish_time = date('Y-m-d H:i:s');
                     $add_time = date('Y-m-d H:i:s');
                     if (isset($formDataSave['author']) && $formDataSave['author'] == "Self") {
                         $author_id = $publisher_id;
                     } elseif (isset($formDataSave['author']) && !empty($formDataSave['author'])) {
                         $author_id = $formDataSave['author'];
                     } else {
                         $author_id = '';
                     }
                     $formDataSave['isbn_number'] = !empty($formDataSave['issn_number']) ? $formDataSave['issn_number'] : !empty($formDataSave['isbn_number']) ? $formDataSave['isbn_number'] : "";
                     $publisherData = array('product_type' => $formDataSave['book_genre'], 'author_id' => $author_id, 'title' => $formDataSave['title'], 'description' => $formDataSave['description'], 'isbn_number' => $formDataSave['isbn_number'], 'publisher' => $formDataSave['publisher'], 'total_pages' => $formDataSave['total_pages'], 'cat_id' => $formDataSave['category'], 'publish_time' => $publish_time);
                     $result = $this->modelBooks->update($publisherData, 'id=' . $id);
                     $this->_flashMessenger->addMessage('<div class="div-success">Publication updated successfully</div>');
                     $this->_redirect('publisher/book/index/tab_ajax/book');
                 } else {
                     $this->view->errorMessage = '<div class="div-error">Please enter required field properly.</div>';
                 }
             }
         }
         $this->view->formData = $formData;
         $this->view->formErrors = $formErrors;
         //print_r($formData);exit;
     } else {
         $this->_redirect('publisher/book/index/tab_ajax/book');
     }
 }
开发者ID:vmangla,项目名称:evendor,代码行数:100,代码来源:BookController_02052013.php


注:本文中的CommonFunctions::is_issn_valid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。