इसे छोड़कर कंटेंट पर जाएं

प्रकाशक मॉड्यूल विश्लेषण

यह दस्तावेज़ प्रकाशक मॉड्यूल वास्तुकला, पैटर्न और कार्यान्वयन विवरण का तकनीकी विश्लेषण प्रदान करता है। उत्पादन-गुणवत्ता XOOPS मॉड्यूल कैसे संरचित है, यह समझने के लिए इसे एक संदर्भ के रूप में उपयोग करें।

वास्तुकला अवलोकन

Section titled “वास्तुकला अवलोकन”
flowchart TB
subgraph "Presentation Layer"
FE[Frontend Pages]
AD[Admin Panel]
BL[Blocks]
end
subgraph "Application Layer"
PH[Page Handlers]
BH[Block Handlers]
FO[Forms]
end
subgraph "Domain Layer"
IT[Item Entity]
CA[Category Entity]
FI[File Entity]
end
subgraph "Infrastructure"
IH[ItemHandler]
CH[CategoryHandler]
FH[FileHandler]
DB[(Database)]
end
FE --> PH
AD --> PH
BL --> BH
PH --> IT
PH --> CA
BH --> IT
IT --> IH
CA --> CH
FI --> FH
IH --> DB
CH --> DB
FH --> DB

निर्देशिका संरचना

Section titled “निर्देशिका संरचना”
publisher/
├── admin/
│ ├── index.php # Admin dashboard
│ ├── item.php # Article management
│ ├── category.php # Category management
│ ├── permission.php # Permissions
│ ├── file.php # File manager
│ └── menu.php # Admin menu
├── assets/
│ ├── css/
│ ├── js/
│ └── images/
├── class/
│ ├── Category.php # Category entity
│ ├── CategoryHandler.php # Category data access
│ ├── Item.php # Article entity
│ ├── ItemHandler.php # Article data access
│ ├── File.php # File attachment
│ ├── FileHandler.php # File data access
│ ├── Form/ # Form classes
│ ├── Common/ # Utilities
│ └── Helper.php # Module helper
├── include/
│ ├── common.php # Initialization
│ ├── functions.php # Utility functions
│ ├── oninstall.php # Install hooks
│ ├── onupdate.php # Update hooks
│ └── search.php # Search integration
├── language/
├── templates/
├── sql/
└── xoops_version.php

आइटम (अनुच्छेद) इकाई

Section titled “आइटम (अनुच्छेद) इकाई”
class Item extends \XoopsObject
{
// Fields
public function initVar(): void
{
$this->initVar('itemid', XOBJ_DTYPE_INT, null, false);
$this->initVar('categoryid', XOBJ_DTYPE_INT, 0, false);
$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', true);
$this->initVar('subtitle', XOBJ_DTYPE_TXTBOX, '');
$this->initVar('summary', XOBJ_DTYPE_TXTAREA, '');
$this->initVar('body', XOBJ_DTYPE_TXTAREA, '', true);
$this->initVar('uid', XOBJ_DTYPE_INT, 0);
$this->initVar('status', XOBJ_DTYPE_INT, 0);
$this->initVar('datesub', XOBJ_DTYPE_INT, time());
// ... more fields
}
// Business methods
public function isPublished(): bool
{
return $this->getVar('status') == _PUBLISHER_STATUS_PUBLISHED;
}
public function canEdit(int $userId): bool
{
return $this->getVar('uid') == $userId
|| $this->isAdmin($userId);
}
}
class ItemHandler extends \XoopsPersistableObjectHandler
{
public function __construct(\XoopsDatabase $db)
{
parent::__construct(
$db,
'publisher_items',
Item::class,
'itemid',
'title'
);
}
public function getPublishedItems(int $limit = 10): array
{
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('status', _PUBLISHER_STATUS_PUBLISHED));
$criteria->setSort('datesub');
$criteria->setOrder('DESC');
$criteria->setLimit($limit);
return $this->getObjects($criteria);
}
}
अनुमतिविवरण
publisher_viewश्रेणी/लेख देखें
publisher_submitनए लेख सबमिट करें
publisher_approveस्वतः-अनुमोदन प्रस्तुतियाँ
publisher_moderateलंबित लेखों की समीक्षा करें
publisher_globalवैश्विक मॉड्यूल अनुमतियाँ
class PermissionHandler
{
public function isGranted(string $permission, int $categoryId): bool
{
$userId = $GLOBALS['xoopsUser']?->uid() ?? 0;
$groups = $this->getUserGroups($userId);
return $this->grouppermHandler->checkRight(
$permission,
$categoryId,
$groups,
$this->helper->getModule()->mid()
);
}
}

वर्कफ़्लो स्थितियाँ

Section titled “वर्कफ़्लो स्थितियाँ”
stateDiagram-v2
[*] --> Draft: Create
Draft --> Submitted: Submit
Submitted --> Published: Approve
Submitted --> Rejected: Reject
Submitted --> Draft: Return for Edit
Published --> Offline: Unpublish
Offline --> Published: Republish
Published --> [*]: Delete
Rejected --> [*]: Delete

टेम्पलेट संरचना

Section titled “टेम्पलेट संरचना”

फ्रंटएंड टेम्पलेट्स

Section titled “फ्रंटएंड टेम्पलेट्स”
टेम्पलेटउद्देश्य
publisher_index.tplमॉड्यूल होमपेज
publisher_item.tplएकल लेख
publisher_category.tplश्रेणी सूची
publisher_submit.tplसबमिशन फॉर्म
publisher_search.tplखोज परिणाम

ब्लॉक टेम्पलेट्स

Section titled “ब्लॉक टेम्पलेट्स”
टेम्पलेटउद्देश्य
publisher_block_latest.tplहाल के लेख
publisher_block_spotlight.tplविशेष आलेख
publisher_block_category.tplश्रेणी मेनू

प्रयुक्त प्रमुख पैटर्न

Section titled “प्रयुक्त प्रमुख पैटर्न”
  1. हैंडलर पैटर्न - डेटा एक्सेस इनकैप्सुलेशन
  2. मूल्य वस्तु - स्थिति स्थिरांक
  3. टेम्पलेट विधि - फॉर्म जनरेशन
  4. रणनीति - विभिन्न प्रदर्शन मोड
  5. पर्यवेक्षक - घटनाओं पर सूचनाएं

मॉड्यूल विकास के लिए पाठ

Section titled “मॉड्यूल विकास के लिए पाठ”
  1. CRUD के लिए XoopsPersistableObjectHandler का उपयोग करें
  2. विस्तृत अनुमतियाँ लागू करें
  3. प्रस्तुतीकरण को तर्क से अलग करना
  4. प्रश्नों के लिए Criteria का उपयोग करें
  5. एकाधिक सामग्री स्थितियों का समर्थन करें
  6. XOOPS अधिसूचना प्रणाली के साथ एकीकृत करें

संबंधित दस्तावेज़ीकरण

Section titled “संबंधित दस्तावेज़ीकरण”
  • लेख बनाना - लेख प्रबंधन
  • प्रबंध-श्रेणियाँ - श्रेणी प्रणाली
  • अनुमतियाँ-सेटअप - अनुमति विन्यास
  • डेवलपर-गाइड/हुक-एंड-इवेंट - विस्तार बिंदु