diff --git a/config/module.php b/config/module.php index bd8673e..2aef3e8 100644 --- a/config/module.php +++ b/config/module.php @@ -14,12 +14,12 @@ 'meta' => array( 'title' => _a('Ask'), 'description' => _a('Ask and Answer'), - 'version' => '0.2.2', + 'version' => '0.2.7', 'license' => 'New BSD', 'logo' => 'image/logo.png', 'readme' => 'docs/readme.txt', 'demo' => 'http://pialog', - 'icon' => 'fa-question', + 'icon' => 'fa-database', 'clonable' => true, ), // Author information diff --git a/config/navigation.php b/config/navigation.php index ae21f30..ff01165 100644 --- a/config/navigation.php +++ b/config/navigation.php @@ -21,6 +21,60 @@ 'module' => 'ask', 'controller' => 'question', 'action' => 'index', + 'params' => array( + 'type' => 'all', + ), + 'pages' => array( + 'all' => array( + 'label' => _a('List of all Questions and Answers'), + 'permission' => array( + 'resource' => 'question', + ), + 'route' => 'admin', + 'module' => 'ask', + 'controller' => 'question', + 'action' => 'index', + 'params' => array( + 'type' => 'all', + ), + ), + 'question' => array( + 'label' => _a('List of just Questions'), + 'permission' => array( + 'resource' => 'question', + ), + 'route' => 'admin', + 'module' => 'ask', + 'controller' => 'question', + 'action' => 'index', + 'params' => array( + 'type' => 'question', + ), + ), + 'answer' => array( + 'label' => _a('List of just Answers'), + 'permission' => array( + 'resource' => 'question', + ), + 'route' => 'admin', + 'module' => 'ask', + 'controller' => 'question', + 'action' => 'index', + 'params' => array( + 'type' => 'answer', + ), + ), + 'update' => array( + 'label' => _a('New question'), + 'permission' => array( + 'resource' => 'question', + ), + 'route' => 'admin', + 'module' => 'ask', + 'controller' => 'question', + 'action' => 'update', + ), + ), ), 'project' => array( 'label' => _a('projects'), @@ -54,15 +108,5 @@ ), ), ), - 'tools' => array( - 'label' => _a('Tools'), - 'permission' => array( - 'resource' => 'tools', - ), - 'route' => 'admin', - 'module' => 'ask', - 'controller' => 'tools', - 'action' => 'index', - ), ), ); \ No newline at end of file diff --git a/config/page.php b/config/page.php index 864ca8f..6493c4e 100644 --- a/config/page.php +++ b/config/page.php @@ -23,11 +23,6 @@ 'controller' => 'project', 'permission' => 'project', ), - array( - 'title' => _a('Tools'), - 'controller' => 'tools', - 'permission' => 'tools', - ), ), // Front section 'front' => array( diff --git a/config/permission.php b/config/permission.php index 5da70eb..6949de0 100755 --- a/config/permission.php +++ b/config/permission.php @@ -47,11 +47,5 @@ //'admin', ), ), - 'tools' => array( - 'title' => _a('Tools'), - 'access' => array( - //'admin', - ), - ), ), ); \ No newline at end of file diff --git a/locale/en/admin.mo b/locale/en/admin.mo index 0c57482..a7dd459 100644 Binary files a/locale/en/admin.mo and b/locale/en/admin.mo differ diff --git a/locale/en/admin.po b/locale/en/admin.po index 36fecdb..6667470 100644 --- a/locale/en/admin.po +++ b/locale/en/admin.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2017-08-06 12:35+0430\n" +"POT-Creation-Date: 2017-08-06 13:38+0430\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -23,7 +23,7 @@ msgstr "" msgid "Show" msgstr "" -#: config/config.php:24 config/page.php:53 +#: config/config.php:24 config/page.php:48 msgid "Question" msgstr "" @@ -111,36 +111,48 @@ msgstr "" msgid "List of Questions" msgstr "" -#: config/navigation.php:26 config/navigation.php:36 config/page.php:22 +#: config/navigation.php:29 +msgid "List of all Questions and Answers" +msgstr "" + +#: config/navigation.php:42 +msgid "List of just Questions" +msgstr "" + +#: config/navigation.php:55 +msgid "List of just Answers" +msgstr "" + +#: config/navigation.php:68 +msgid "New question" +msgstr "" + +#: config/navigation.php:80 config/navigation.php:90 config/page.php:22 #: config/permission.php:45 msgid "projects" msgstr "" -#: config/navigation.php:46 +#: config/navigation.php:100 msgid "New project" msgstr "" -#: config/navigation.php:58 config/page.php:27 config/permission.php:51 -msgid "Tools" -msgstr "" - -#: config/page.php:35 +#: config/page.php:30 msgid "Index page" msgstr "" -#: config/page.php:41 +#: config/page.php:36 msgid "Project page" msgstr "" -#: config/page.php:47 config/permission.php:30 +#: config/page.php:42 config/permission.php:30 msgid "Answer" msgstr "" -#: config/page.php:59 +#: config/page.php:54 msgid "Submit question" msgstr "" -#: config/page.php:65 +#: config/page.php:60 msgid "Tag" msgstr "" diff --git a/locale/en/default.mo b/locale/en/default.mo index 6d9b8c4..6afb018 100644 Binary files a/locale/en/default.mo and b/locale/en/default.mo differ diff --git a/locale/en/default.po b/locale/en/default.po index 1e43996..d3c65df 100644 --- a/locale/en/default.po +++ b/locale/en/default.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2017-08-06 12:35+0430\n" +"POT-Creation-Date: 2017-08-06 13:34+0430\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -36,26 +36,26 @@ msgstr "" msgid "Add project" msgstr "" -#: src/Controller/Admin/QuestionController.php:85 +#: src/Controller/Admin/QuestionController.php:98 #, php-format msgid "%s question accept successfully" msgstr "" -#: src/Controller/Admin/QuestionController.php:90 +#: src/Controller/Admin/QuestionController.php:103 #, php-format msgid "Error in accept %s question" msgstr "" -#: src/Controller/Admin/QuestionController.php:96 -#: src/Controller/Admin/QuestionController.php:185 +#: src/Controller/Admin/QuestionController.php:109 +#: src/Controller/Admin/QuestionController.php:222 msgid "Please select question" msgstr "" -#: src/Controller/Admin/QuestionController.php:154 +#: src/Controller/Admin/QuestionController.php:189 msgid "Your selected item edit successfully" msgstr "" -#: src/Controller/Admin/QuestionController.php:183 +#: src/Controller/Admin/QuestionController.php:220 msgid "Your selected question deleted" msgstr "" @@ -143,7 +143,7 @@ msgstr "" msgid "List of all used tags" msgstr "" -#: src/Form/AnswerForm.php:49 template/admin/question-index.phtml:32 +#: src/Form/AnswerForm.php:49 template/admin/question-index.phtml:26 #: template/front/question-index.phtml:104 #: template/front/question-index.phtml:108 #: template/front/question-list.phtml:73 @@ -151,43 +151,44 @@ msgid "Answer" msgstr "" #: src/Form/AnswerForm.php:63 src/Form/AskForm.php:107 -#: src/Form/ProjectForm.php:180 src/Form/UpdateForm.php:81 +#: src/Form/ProjectForm.php:180 src/Form/UpdateForm.php:202 msgid "Submit" msgstr "" #: src/Form/AskForm.php:42 src/Form/ProjectForm.php:42 -#: src/Form/UpdateForm.php:42 template/admin/project-index.phtml:8 +#: src/Form/UpdateForm.php:48 template/admin/project-index.phtml:8 #: template/admin/question-index.phtml:15 -#: template/admin/question-update.phtml:3 +#: template/admin/question-update.phtml:5 msgid "Title" msgstr "" -#: src/Form/AskForm.php:53 src/Form/UpdateForm.php:53 -#: template/admin/question-index.phtml:29 +#: src/Form/AskForm.php:53 src/Form/UpdateForm.php:70 +#: template/admin/question-index.phtml:23 msgid "Question" msgstr "" #: src/Form/AskForm.php:67 src/Form/ProjectForm.php:78 +#: src/Form/UpdateForm.php:84 msgid "Main image" msgstr "" -#: src/Form/AskForm.php:94 src/Form/UpdateForm.php:68 +#: src/Form/AskForm.php:94 src/Form/UpdateForm.php:189 msgid "Tags" msgstr "" -#: src/Form/AskForm.php:98 src/Form/UpdateForm.php:72 +#: src/Form/AskForm.php:98 src/Form/UpdateForm.php:193 msgid "Use `|` as delimiter to separate tag terms" msgstr "" -#: src/Form/ProjectForm.php:53 +#: src/Form/ProjectForm.php:53 src/Form/UpdateForm.php:59 msgid "slug" msgstr "" -#: src/Form/ProjectForm.php:57 +#: src/Form/ProjectForm.php:57 src/Form/UpdateForm.php:63 msgid "Used on URL value : must be unique, short, and user oriented" msgstr "" -#: src/Form/ProjectForm.php:64 template/admin/question-update.phtml:5 +#: src/Form/ProjectForm.php:64 template/admin/question-update.phtml:14 msgid "Description" msgstr "" @@ -195,29 +196,29 @@ msgstr "" msgid "Additional images" msgstr "" -#: src/Form/ProjectForm.php:104 +#: src/Form/ProjectForm.php:104 src/Form/UpdateForm.php:110 msgid "Status" msgstr "" -#: src/Form/ProjectForm.php:106 template/admin/project-index.phtml:34 -#: template/admin/question-index.phtml:62 +#: src/Form/ProjectForm.php:106 src/Form/UpdateForm.php:112 +#: template/admin/project-index.phtml:34 template/admin/question-index.phtml:61 msgid "Published" msgstr "" -#: src/Form/ProjectForm.php:107 template/admin/project-index.phtml:35 -#: template/admin/question-index.phtml:63 +#: src/Form/ProjectForm.php:107 src/Form/UpdateForm.php:113 +#: template/admin/project-index.phtml:35 template/admin/question-index.phtml:62 msgid "Pending review" msgstr "" -#: src/Form/ProjectForm.php:108 +#: src/Form/ProjectForm.php:108 src/Form/UpdateForm.php:114 msgid "Draft" msgstr "" -#: src/Form/ProjectForm.php:109 +#: src/Form/ProjectForm.php:109 src/Form/UpdateForm.php:115 msgid "Private" msgstr "" -#: src/Form/ProjectForm.php:110 +#: src/Form/ProjectForm.php:110 src/Form/UpdateForm.php:116 msgid "Remove" msgstr "" @@ -229,45 +230,49 @@ msgstr "" msgid "Project manager user id" msgstr "" -#: src/Form/ProjectForm.php:133 +#: src/Form/ProjectForm.php:133 src/Form/UpdateForm.php:141 msgid "SEO options" msgstr "" -#: src/Form/ProjectForm.php:140 +#: src/Form/ProjectForm.php:140 src/Form/UpdateForm.php:148 msgid "Meta Title" msgstr "" -#: src/Form/ProjectForm.php:146 +#: src/Form/ProjectForm.php:146 src/Form/UpdateForm.php:154 msgid "" "Displayed in search Engine result pages as Title : between 10 to 70 " "character. If empty, will be popuated automaticaly by main title value" msgstr "" -#: src/Form/ProjectForm.php:153 +#: src/Form/ProjectForm.php:153 src/Form/UpdateForm.php:161 msgid "Meta Keywords" msgstr "" -#: src/Form/ProjectForm.php:159 +#: src/Form/ProjectForm.php:159 src/Form/UpdateForm.php:167 msgid "" "Not used anymore by search engines : between 5 to 12 words / left it empty, " "it will be automaticaly populated with main title values" msgstr "" -#: src/Form/ProjectForm.php:166 +#: src/Form/ProjectForm.php:166 src/Form/UpdateForm.php:174 msgid "Meta Description" msgstr "" -#: src/Form/ProjectForm.php:172 +#: src/Form/ProjectForm.php:172 src/Form/UpdateForm.php:180 msgid "" "Displayed in search Engine result pages : quick summary to incitate user to " "click, between 80 to 160 character" msgstr "" +#: src/Form/UpdateForm.php:129 +msgid "Project" +msgstr "" + #: template/admin/project-index.phtml:4 msgid "List of projects" msgstr "" -#: template/admin/project-index.phtml:7 template/admin/question-index.phtml:14 +#: template/admin/project-index.phtml:7 msgid "ID" msgstr "" @@ -280,7 +285,7 @@ msgid "View" msgstr "" #: template/admin/project-index.phtml:26 template/admin/project-index.phtml:28 -#: template/admin/question-index.phtml:54 +#: template/admin/question-index.phtml:53 msgid "Edit" msgstr "" @@ -293,29 +298,29 @@ msgid "List of questions and answers" msgstr "" #: template/admin/question-index.phtml:16 -msgid "Type" +msgid "User" msgstr "" #: template/admin/question-index.phtml:17 -#: template/admin/question-update.phtml:6 +#: template/admin/question-update.phtml:11 msgid "Create" msgstr "" -#: template/admin/question-index.phtml:50 +#: template/admin/question-index.phtml:49 #: template/admin/question-index.phtml:78 msgid "Reject" msgstr "" -#: template/admin/question-index.phtml:52 +#: template/admin/question-index.phtml:51 #: template/admin/question-index.phtml:83 msgid "Accept" msgstr "" -#: template/admin/question-index.phtml:55 +#: template/admin/question-index.phtml:54 msgid "Delete" msgstr "" -#: template/admin/question-index.phtml:66 +#: template/admin/question-index.phtml:65 msgid "No question submit yet" msgstr "" @@ -323,7 +328,7 @@ msgstr "" msgid "Accept in process" msgstr "" -#: template/admin/question-update.phtml:4 +#: template/admin/question-update.phtml:8 msgid "Slug" msgstr "" diff --git a/locale/fa/admin.mo b/locale/fa/admin.mo index 7f7c27f..78bcaac 100644 Binary files a/locale/fa/admin.mo and b/locale/fa/admin.mo differ diff --git a/locale/fa/admin.po b/locale/fa/admin.po index 8d7de1e..ea81255 100644 --- a/locale/fa/admin.po +++ b/locale/fa/admin.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2017-08-06 12:07+0430\n" +"POT-Creation-Date: 2017-08-06 13:36+0430\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -111,16 +111,32 @@ msgstr "سیستم ارسال پرسش و درج پاسخ" msgid "List of Questions" msgstr "فهرست سوالات" -#: config/navigation.php:26 config/navigation.php:36 config/page.php:22 +#: config/navigation.php:29 +msgid "List of all Questions and Answers" +msgstr "فهرست سوالات و پاسخ ها" + +#: config/navigation.php:42 +msgid "List of just Questions" +msgstr "فهرست سوال ها" + +#: config/navigation.php:55 +msgid "List of just Answers" +msgstr "فهرست پاسخ ها" + +#: config/navigation.php:68 +msgid "New question" +msgstr "سوال جدید" + +#: config/navigation.php:80 config/navigation.php:90 config/page.php:22 #: config/permission.php:45 msgid "projects" msgstr "پروژه ها" -#: config/navigation.php:46 +#: config/navigation.php:100 msgid "New project" msgstr "پروژه جدید" -#: config/navigation.php:58 config/page.php:27 config/permission.php:51 +#: config/navigation.php:112 config/page.php:27 config/permission.php:51 msgid "Tools" msgstr "ابزار" diff --git a/locale/fa/default.mo b/locale/fa/default.mo index 82f559d..b6b0882 100644 Binary files a/locale/fa/default.mo and b/locale/fa/default.mo differ diff --git a/locale/fa/default.po b/locale/fa/default.po index 1a09acb..42d26e3 100644 --- a/locale/fa/default.po +++ b/locale/fa/default.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2017-08-06 12:09+0430\n" +"POT-Creation-Date: 2017-08-06 13:36+0430\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -36,26 +36,26 @@ msgstr "اطلاعات پروژه با موفقیت ذخیره شد" msgid "Add project" msgstr "پروژه جدید" -#: src/Controller/Admin/QuestionController.php:85 +#: src/Controller/Admin/QuestionController.php:98 #, php-format msgid "%s question accept successfully" msgstr "%s با موفقیت تایید شد" -#: src/Controller/Admin/QuestionController.php:90 +#: src/Controller/Admin/QuestionController.php:103 #, php-format msgid "Error in accept %s question" msgstr "خطا در تایید %s" -#: src/Controller/Admin/QuestionController.php:96 -#: src/Controller/Admin/QuestionController.php:185 +#: src/Controller/Admin/QuestionController.php:109 +#: src/Controller/Admin/QuestionController.php:222 msgid "Please select question" msgstr "لطفا یک سوال انتخاب کنید" -#: src/Controller/Admin/QuestionController.php:154 +#: src/Controller/Admin/QuestionController.php:189 msgid "Your selected item edit successfully" msgstr "آیتم انتخابی شما با موفقیت ویرایش شد" -#: src/Controller/Admin/QuestionController.php:183 +#: src/Controller/Admin/QuestionController.php:220 msgid "Your selected question deleted" msgstr "سوال انتخابی شما حذف شد" @@ -77,17 +77,17 @@ msgid "The question not found." msgstr "سوال یافت نشد" #: src/Controller/Front/AnswerController.php:54 -#: src/Controller/Front/AnswerController.php:99 +#: src/Controller/Front/AnswerController.php:101 #, php-format msgid "Answer to %s" msgstr "پاسخ به %s" -#: src/Controller/Front/AnswerController.php:87 +#: src/Controller/Front/AnswerController.php:89 msgid "" "Your new answer to this question save successfully, and show under question" msgstr "پاسخ شما به این پرسش با موفقیت ثبت شد، و در زیر سوال نمایش داده می شود" -#: src/Controller/Front/AnswerController.php:89 +#: src/Controller/Front/AnswerController.php:91 msgid "" "Your new answer to this question save successfully, But it need review and " "publish by website admin" @@ -148,7 +148,7 @@ msgstr "همه سوالات در مورد %s" msgid "List of all used tags" msgstr "فهرست تمام برچسب های استفاده شده" -#: src/Form/AnswerForm.php:49 template/admin/question-index.phtml:32 +#: src/Form/AnswerForm.php:49 template/admin/question-index.phtml:26 #: template/front/question-index.phtml:104 #: template/front/question-index.phtml:108 #: template/front/question-list.phtml:73 @@ -156,43 +156,44 @@ msgid "Answer" msgstr "پاسخ" #: src/Form/AnswerForm.php:63 src/Form/AskForm.php:107 -#: src/Form/ProjectForm.php:180 src/Form/UpdateForm.php:81 +#: src/Form/ProjectForm.php:180 src/Form/UpdateForm.php:202 msgid "Submit" msgstr "ارسال" #: src/Form/AskForm.php:42 src/Form/ProjectForm.php:42 -#: src/Form/UpdateForm.php:42 template/admin/project-index.phtml:8 +#: src/Form/UpdateForm.php:48 template/admin/project-index.phtml:8 #: template/admin/question-index.phtml:15 -#: template/admin/question-update.phtml:3 +#: template/admin/question-update.phtml:5 msgid "Title" msgstr "عنوان" -#: src/Form/AskForm.php:53 src/Form/UpdateForm.php:53 -#: template/admin/question-index.phtml:29 +#: src/Form/AskForm.php:53 src/Form/UpdateForm.php:70 +#: template/admin/question-index.phtml:23 msgid "Question" msgstr "سوال" #: src/Form/AskForm.php:67 src/Form/ProjectForm.php:78 +#: src/Form/UpdateForm.php:84 msgid "Main image" msgstr "تصویر اصلی" -#: src/Form/AskForm.php:94 src/Form/UpdateForm.php:68 +#: src/Form/AskForm.php:94 src/Form/UpdateForm.php:189 msgid "Tags" msgstr "برچسب ها" -#: src/Form/AskForm.php:98 src/Form/UpdateForm.php:72 +#: src/Form/AskForm.php:98 src/Form/UpdateForm.php:193 msgid "Use `|` as delimiter to separate tag terms" msgstr "با استفاده از `|` کلمات را از هم جدا کنید" -#: src/Form/ProjectForm.php:53 +#: src/Form/ProjectForm.php:53 src/Form/UpdateForm.php:59 msgid "slug" msgstr "اسلاگ" -#: src/Form/ProjectForm.php:57 +#: src/Form/ProjectForm.php:57 src/Form/UpdateForm.php:63 msgid "Used on URL value : must be unique, short, and user oriented" msgstr "در آدرس URL صفحه استفاده می شود، باید یکتا، کوتاه و مفید باشد" -#: src/Form/ProjectForm.php:64 template/admin/question-update.phtml:5 +#: src/Form/ProjectForm.php:64 template/admin/question-update.phtml:14 msgid "Description" msgstr "توضیحات" @@ -200,29 +201,29 @@ msgstr "توضیحات" msgid "Additional images" msgstr "تصاویر اضافی" -#: src/Form/ProjectForm.php:104 +#: src/Form/ProjectForm.php:104 src/Form/UpdateForm.php:110 msgid "Status" msgstr "وضعیت" -#: src/Form/ProjectForm.php:106 template/admin/project-index.phtml:34 -#: template/admin/question-index.phtml:62 +#: src/Form/ProjectForm.php:106 src/Form/UpdateForm.php:112 +#: template/admin/project-index.phtml:34 template/admin/question-index.phtml:61 msgid "Published" msgstr "منتشر شده" -#: src/Form/ProjectForm.php:107 template/admin/project-index.phtml:35 -#: template/admin/question-index.phtml:63 +#: src/Form/ProjectForm.php:107 src/Form/UpdateForm.php:113 +#: template/admin/project-index.phtml:35 template/admin/question-index.phtml:62 msgid "Pending review" msgstr "در انتظار تایید" -#: src/Form/ProjectForm.php:108 +#: src/Form/ProjectForm.php:108 src/Form/UpdateForm.php:114 msgid "Draft" msgstr "پیش نویس" -#: src/Form/ProjectForm.php:109 +#: src/Form/ProjectForm.php:109 src/Form/UpdateForm.php:115 msgid "Private" msgstr "خصوصی" -#: src/Form/ProjectForm.php:110 +#: src/Form/ProjectForm.php:110 src/Form/UpdateForm.php:116 msgid "Remove" msgstr "حذف شده" @@ -234,45 +235,49 @@ msgstr "مدیر" msgid "Project manager user id" msgstr "شناسه کاربری مدیر پروژه" -#: src/Form/ProjectForm.php:133 +#: src/Form/ProjectForm.php:133 src/Form/UpdateForm.php:141 msgid "SEO options" msgstr "گزینه های سئو" -#: src/Form/ProjectForm.php:140 +#: src/Form/ProjectForm.php:140 src/Form/UpdateForm.php:148 msgid "Meta Title" msgstr "عنوان متا ( Meta Title )" -#: src/Form/ProjectForm.php:146 +#: src/Form/ProjectForm.php:146 src/Form/UpdateForm.php:154 msgid "" "Displayed in search Engine result pages as Title : between 10 to 70 " "character. If empty, will be popuated automaticaly by main title value" msgstr "" -#: src/Form/ProjectForm.php:153 +#: src/Form/ProjectForm.php:153 src/Form/UpdateForm.php:161 msgid "Meta Keywords" msgstr "کلمات کلیدی متا ( Meta Keywords )" -#: src/Form/ProjectForm.php:159 +#: src/Form/ProjectForm.php:159 src/Form/UpdateForm.php:167 msgid "" "Not used anymore by search engines : between 5 to 12 words / left it empty, " "it will be automaticaly populated with main title values" msgstr "" -#: src/Form/ProjectForm.php:166 +#: src/Form/ProjectForm.php:166 src/Form/UpdateForm.php:174 msgid "Meta Description" msgstr "توضیحات متا (Meta Keywords )" -#: src/Form/ProjectForm.php:172 +#: src/Form/ProjectForm.php:172 src/Form/UpdateForm.php:180 msgid "" "Displayed in search Engine result pages : quick summary to incitate user to " "click, between 80 to 160 character" msgstr "" +#: src/Form/UpdateForm.php:129 +msgid "Project" +msgstr "پروژه" + #: template/admin/project-index.phtml:4 msgid "List of projects" msgstr "فهرست پروژه ها" -#: template/admin/project-index.phtml:7 template/admin/question-index.phtml:14 +#: template/admin/project-index.phtml:7 msgid "ID" msgstr "شناسه" @@ -285,7 +290,7 @@ msgid "View" msgstr "نمایش" #: template/admin/project-index.phtml:26 template/admin/project-index.phtml:28 -#: template/admin/question-index.phtml:54 +#: template/admin/question-index.phtml:53 msgid "Edit" msgstr "ویرایش" @@ -298,29 +303,29 @@ msgid "List of questions and answers" msgstr "فهرست سوالات و پاسخ ها" #: template/admin/question-index.phtml:16 -msgid "Type" -msgstr "نوع" +msgid "User" +msgstr "کاربر" #: template/admin/question-index.phtml:17 -#: template/admin/question-update.phtml:6 +#: template/admin/question-update.phtml:11 msgid "Create" msgstr "ایجاد" -#: template/admin/question-index.phtml:50 +#: template/admin/question-index.phtml:49 #: template/admin/question-index.phtml:78 msgid "Reject" msgstr "رد کردن" -#: template/admin/question-index.phtml:52 +#: template/admin/question-index.phtml:51 #: template/admin/question-index.phtml:83 msgid "Accept" msgstr "تایید" -#: template/admin/question-index.phtml:55 +#: template/admin/question-index.phtml:54 msgid "Delete" msgstr "حذف" -#: template/admin/question-index.phtml:66 +#: template/admin/question-index.phtml:65 msgid "No question submit yet" msgstr "هنوز هیچ سوالی ارسال نشده است" @@ -328,7 +333,7 @@ msgstr "هنوز هیچ سوالی ارسال نشده است" msgid "Accept in process" msgstr "تایید در حال انجام است" -#: template/admin/question-update.phtml:4 +#: template/admin/question-update.phtml:8 msgid "Slug" msgstr "اسلاگ" @@ -403,6 +408,9 @@ msgstr "" "هیچ اطلاعاتی از کلمات کلیدی به عنوان برچسب هنوز در سیستم درج نشده است. لطفا " "بعدا از این صفحه را بررسی فرمایید. " +#~ msgid "Type" +#~ msgstr "نوع" + #~ msgid "The tag not set." #~ msgstr "برچسب یافت نشد" diff --git a/src/Controller/Admin/IndexController.php b/src/Controller/Admin/IndexController.php index 782ca0b..3c953ed 100644 --- a/src/Controller/Admin/IndexController.php +++ b/src/Controller/Admin/IndexController.php @@ -22,6 +22,7 @@ public function indexAction() return $this->redirect()->toRoute('', array( 'controller' => 'question', 'action' => 'index', + 'type' => 'all', )); } } diff --git a/src/Controller/Admin/QuestionController.php b/src/Controller/Admin/QuestionController.php index 289bcda..9e90f22 100644 --- a/src/Controller/Admin/QuestionController.php +++ b/src/Controller/Admin/QuestionController.php @@ -19,6 +19,7 @@ use Module\Ask\Form\UpdateForm; use Module\Ask\Form\UpdateFilter; use Zend\Json\Json; +use Zend\Db\Sql\Predicate\Expression; class QuestionController extends ActionController { @@ -26,8 +27,8 @@ public function indexAction() { // Get page $page = $this->params('page', 1); - $module = $this->params('module'); $status = $this->params('status'); + $type = $this->params('type'); // Set info $offset = (int)($page - 1) * $this->config('admin_perpage'); $order = array('time_create DESC', 'id DESC'); @@ -38,15 +39,26 @@ public function indexAction() if (!empty($status)) { $where['status'] = $status; } + if (!empty($type) && $type == 'question') { + $where['type'] = 'Q'; + } elseif (!empty($type) && $type == 'answer') { + $where['type'] = 'A'; + } // Set select $select = $this->getModel('question')->select()->where($where)->order($order)->offset($offset)->limit($limit); $rowset = $this->getModel('question')->selectWith($select); // Make list foreach ($rowset as $row) { $question[$row->id] = Pi::api('question', 'ask')->canonizeQuestion($row); + $question[$row->id]['user_url'] = Pi::url($this->url('', array( + 'module' => 'user', + 'controller' => 'edit', + 'action' => 'index', + 'uid' => $row->uid, + ))); } // Set paginator - $count = array('count' => new \Zend\Db\Sql\Predicate\Expression('count(*)')); + $count = array('count' => new Expression('count(*)')); $select = $this->getModel('question')->select()->where($where)->columns($count); $count = $this->getModel('question')->selectWith($select)->current()->count; $paginator = Paginator::factory(intval($count)); @@ -60,6 +72,7 @@ public function indexAction() 'controller' => 'question', 'action' => 'index', 'status' => $status, + 'type' => $type, )), )); // Set view @@ -106,12 +119,23 @@ public function updateAction() // Get id $id = $this->params('id'); $module = $this->params('module'); - // find item - $question = Pi::api('question', 'ask')->getQuestion($id); - $form = new UpdateForm('question'); + // Get config + $config = Pi::service('registry')->config->read($module); + // Set option + $option = array( + 'project_active' => $config['project_active'], + ); + // Get question + if ($id) { + $question = Pi::api('question', 'ask')->getQuestion($id); + } else { + $question = array(); + } + // form + $form = new UpdateForm('question', $option); if ($this->request->isPost()) { $data = $this->request->getPost(); - $form->setInputFilter(new UpdateFilter); + $form->setInputFilter(new UpdateFilter($option)); $form->setData($data); if ($form->isValid()) { $values = $form->getData(); @@ -141,9 +165,20 @@ public function updateAction() $filter = new Filter\HeadDescription; $values['seo_description'] = $filter($description); // Set time - $values['time_update'] = time(); + if (!empty($values['id'])) { + $values['time_update'] = time(); + } else { + $values['time_create'] = time(); + $values['time_update'] = time(); + $values['uid'] = Pi::user()->getId(); + $values['type'] = 'Q'; + } // Save values - $row = $this->getModel('question')->find($values['id']); + if (!empty($values['id'])) { + $row = $this->getModel('question')->find($values['id']); + } else { + $row = $this->getModel('question')->createRow(); + } $row->assign($values); $row->save(); // Tag @@ -152,19 +187,21 @@ public function updateAction() } // Check it save or not $message = __('Your selected item edit successfully'); - $url = array('', 'module' => $module, 'controller' => 'question', 'action' => 'index'); + $url = array('', 'module' => $module, 'controller' => 'question', 'action' => 'index', 'type' => 'all'); $this->jump($url, $message); } } else { - // Get tag list - if (Pi::service('module')->isActive('tag')) { - $tag = Pi::service('tag')->get($module, $question['id'], ''); - if (is_array($tag)) { - $question['tag'] = implode('|', $tag); + if ($id) { + // Get tag list + if (Pi::service('module')->isActive('tag')) { + $tag = Pi::service('tag')->get($module, $question['id'], ''); + if (is_array($tag)) { + $question['tag'] = implode('|', $tag); + } } + // Set to form + $form->setData($question); } - // Set to form - $form->setData($question); } // Set view $this->view()->setTemplate('question-update'); @@ -180,9 +217,9 @@ public function deleteAction() $row = $this->getModel('question')->find($id); if ($row) { $row->delete(); - $this->jump(array('action' => 'index'), __('Your selected question deleted')); + $this->jump(array('action' => 'index', 'type' => 'all'), __('Your selected question deleted')); } else { - $this->jump(array('action' => 'index'), __('Please select question')); + $this->jump(array('action' => 'index', 'type' => 'all'), __('Please select question')); } } } \ No newline at end of file diff --git a/src/Controller/Admin/ToolsController.php b/src/Controller/Admin/ToolsController.php deleted file mode 100644 index 727d262..0000000 --- a/src/Controller/Admin/ToolsController.php +++ /dev/null @@ -1,24 +0,0 @@ - - */ -namespace Module\Ask\Controller\Admin; - -use Pi; -use Pi\Mvc\Controller\ActionController; - -class ToolsController extends ActionController -{ - public function indexAction() - { - $this->view()->setTemplate('tools-index'); - } -} \ No newline at end of file diff --git a/src/Form/Element/Project.php b/src/Form/Element/Project.php new file mode 100644 index 0000000..46e5ee8 --- /dev/null +++ b/src/Form/Element/Project.php @@ -0,0 +1,35 @@ + + */ +namespace Module\Ask\Form\Element; + +use Pi; +use Zend\Form\Element\Select; + +class Project extends Select +{ + public function getValueOptions() + { + if (empty($this->valueOptions)) { + $list = array(); + $columns = array('id', 'title'); + $order = array('title ASC', 'id DESC'); + $select = Pi::model('project', 'ask')->select()->columns($columns)->order($order); + $rowset = Pi::model('project', 'ask')->selectWith($select); + foreach ($rowset as $row) { + $list[$row->id] = $row->title; + } + $this->valueOptions = $list; + } + return $this->valueOptions; + } +} \ No newline at end of file diff --git a/src/Form/UpdateFilter.php b/src/Form/UpdateFilter.php index 8c9e6ba..85c8965 100644 --- a/src/Form/UpdateFilter.php +++ b/src/Form/UpdateFilter.php @@ -18,7 +18,7 @@ class UpdateFilter extends InputFilter { - public function __construct() + public function __construct($option = array()) { // id $this->add(array( @@ -35,6 +35,22 @@ public function __construct() ), ), )); + // slug + $this->add(array( + 'name' => 'slug', + 'required' => false, + 'filters' => array( + array( + 'name' => 'StringTrim', + ), + ), + 'validators' => array( + new \Module\Ask\Validator\SlugDuplicate(array( + 'module' => Pi::service('module')->current(), + 'table' => 'question', + )), + ), + )); // text_description $this->add(array( 'name' => 'text_description', @@ -45,6 +61,43 @@ public function __construct() ), ), )); + //main_image + $this->add(array( + 'name' => 'main_image', + 'required' => false, + )); + // additional_images + /* $this->add(array( + 'name' => 'additional_images', + 'required' => false, + )); */ + // status + $this->add(array( + 'name' => 'status', + 'required' => true, + )); + // project_id + if ($option['project_active']) { + $this->add(array( + 'name' => 'project_id', + 'required' => true, + )); + } + // seo_title + $this->add(array( + 'name' => 'seo_title', + 'required' => false, + )); + // seo_keywords + $this->add(array( + 'name' => 'seo_keywords', + 'required' => false, + )); + // seo_description + $this->add(array( + 'name' => 'seo_description', + 'required' => false, + )); // tag if (Pi::service('module')->isActive('tag')) { $this->add(array( diff --git a/src/Form/UpdateForm.php b/src/Form/UpdateForm.php index a7430a5..078cbaf 100644 --- a/src/Form/UpdateForm.php +++ b/src/Form/UpdateForm.php @@ -18,10 +18,16 @@ class UpdateForm extends BaseForm { - public function getInputFilter() + public function __construct($name = null, $option = array()) + { + $this->option = $option; + parent::__construct($name); + } + + public function getInputFilter() { if (!$this->filter) { - $this->filter = new UpdateFilter; + $this->filter = new UpdateFilter($this->option); } return $this->filter; } @@ -46,19 +52,134 @@ public function init() 'description' => '', ) )); + // slug + $this->add(array( + 'name' => 'slug', + 'options' => array( + 'label' => __('slug'), + ), + 'attributes' => array( + 'type' => 'text', + 'description' => __('Used on URL value : must be unique, short, and user oriented'), + ) + )); // text_description $this->add(array( 'name' => 'text_description', 'options' => array( 'label' => __('Question'), - 'editor' => 'html', - 'set' => '', ), 'attributes' => array( - 'type' => 'editor', + 'type' => 'textarea', + 'rows' => '10', + 'cols' => '40', 'description' => '', ) )); + // main_image + $this->add(array( + 'name' => 'main_image', + 'type' => 'Module\Media\Form\Element\Media', + 'options' => array( + 'label' => __('Main image'), + 'media_gallery' => false, + 'media_season' => false, + 'media_season_recommended' => false, + 'is_freemium' => true, + 'can_connect_lists' => false, + ), + )); + // additional_images + /* $this->add(array( + 'name' => 'additional_images', + 'type' => 'Module\Media\Form\Element\Media', + 'options' => array( + 'label' => __('Additional images'), + 'media_gallery' => true, + 'media_season' => false, + 'media_season_recommended' => false, + 'is_freemium' => true, + 'can_connect_lists' => false, + ), + )); */ + // status + $this->add(array( + 'name' => 'status', + 'type' => 'select', + 'options' => array( + 'label' => __('Status'), + 'value_options' => array( + 1 => __('Published'), + 2 => __('Pending review'), + 3 => __('Draft'), + 4 => __('Private'), + 5 => __('Remove'), + ), + ), + 'attributes' => array( + 'required' => true, + ), + )); + // project_id + if ($this->option['project_active']) { + $this->add(array( + 'name' => 'project_id', + 'type' => 'Module\Ask\Form\Element\Project', + 'options' => array( + 'label' => __('Project'), + ), + 'attributes' => array( + 'required' => true, + ), + )); + } + // extra_seo + $this->add(array( + 'name' => 'extra_seo', + 'type' => 'fieldset', + 'options' => array( + 'label' => __('SEO options'), + ), + )); + // seo_title + $this->add(array( + 'name' => 'seo_title', + 'options' => array( + 'label' => __('Meta Title'), + ), + 'attributes' => array( + 'type' => 'textarea', + 'rows' => '2', + 'cols' => '40', + 'description' => __('Displayed in search Engine result pages as Title : between 10 to 70 character. If empty, will be popuated automaticaly by main title value'), + ) + )); + // seo_keywords + $this->add(array( + 'name' => 'seo_keywords', + 'options' => array( + 'label' => __('Meta Keywords'), + ), + 'attributes' => array( + 'type' => 'textarea', + 'rows' => '2', + 'cols' => '40', + 'description' => __('Not used anymore by search engines : between 5 to 12 words / left it empty, it will be automaticaly populated with main title values'), + ) + )); + // seo_description + $this->add(array( + 'name' => 'seo_description', + 'options' => array( + 'label' => __('Meta Description'), + ), + 'attributes' => array( + 'type' => 'textarea', + 'rows' => '3', + 'cols' => '40', + 'description' => __('Displayed in search Engine result pages : quick summary to incitate user to click, between 80 to 160 character'), + ) + )); // tag if (Pi::service('module')->isActive('tag')) { $this->add(array( diff --git a/template/admin/question-index.phtml b/template/admin/question-index.phtml index fa784a8..9f003a8 100644 --- a/template/admin/question-index.phtml +++ b/template/admin/question-index.phtml @@ -11,39 +11,38 @@ $this->js($this->assetModule('script/system-msg.js', 'system'));
- | - | - | - | + + | + | + | + | |
---|---|---|---|---|---|---|---|---|
escape($question['id']); ?> | + - + escape($question['title']); ?> - escape($question['title']); ?> + + escape($question['title']); ?> + | -+ | + + escape($question['user']['name']); ?> + + | escape($question['time_create_view']); ?> | @@ -68,6 +67,7 @@ $this->js($this->assetModule('script/system-msg.js', 'system')); |