| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Joomla.Administrator 4 * @subpackage com_categories 5 * 6 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 // No direct access. 11 defined('_JEXEC') or die; 12 13 jimport('joomla.application.component.modeladmin'); 14 15 /** 16 * Categories Component Category Model 17 * 18 * @package Joomla.Administrator 19 * @subpackage com_categories 20 * @since 1.6 21 */ 22 class CategoriesModelCategory extends JModelAdmin 23 { 24 /** 25 * @var string The prefix to use with controller messages. 26 * @since 1.6 27 */ 28 protected $text_prefix = 'COM_CATEGORIES'; 29 30 /** 31 * Method to test whether a record can be deleted. 32 * 33 * @param object $record A record object. 34 * 35 * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. 36 * 37 * @since 1.6 38 */ 39 protected function canDelete($record) 40 { 41 if (!empty($record->id)) 42 { 43 if ($record->published != -2) 44 { 45 return; 46 } 47 $user = JFactory::getUser(); 48 49 return $user->authorise('core.delete', $record->extension . '.category.' . (int) $record->id); 50 } 51 } 52 53 /** 54 * Method to test whether a record can have its state changed. 55 * 56 * @param object $record A record object. 57 * 58 * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. 59 * 60 * @since 1.6 61 */ 62 protected function canEditState($record) 63 { 64 $user = JFactory::getUser(); 65 66 // Check for existing category. 67 if (!empty($record->id)) 68 { 69 return $user->authorise('core.edit.state', $record->extension . '.category.' . (int) $record->id); 70 } 71 // New category, so check against the parent. 72 elseif (!empty($record->parent_id)) 73 { 74 return $user->authorise('core.edit.state', $record->extension . '.category.' . (int) $record->parent_id); 75 } 76 // Default to component settings if neither category nor parent known. 77 else 78 { 79 return $user->authorise('core.edit.state', $record->extension); 80 } 81 } 82 83 /** 84 * Method to get a table object, load it if necessary. 85 * 86 * @param string $type The table name. Optional. 87 * @param string $prefix The class prefix. Optional. 88 * @param array $config Configuration array for model. Optional. 89 * 90 * @return JTable A JTable object 91 * 92 * @since 1.6 93 */ 94 public function getTable($type = 'Category', $prefix = 'CategoriesTable', $config = array()) 95 { 96 return JTable::getInstance($type, $prefix, $config); 97 } 98 99 /** 100 * Auto-populate the model state. 101 * 102 * Note. Calling getState in this method will result in recursion. 103 * 104 * @return void 105 * 106 * @since 1.6 107 */ 108 protected function populateState() 109 { 110 $app = JFactory::getApplication('administrator'); 111 112 $parentId = JRequest::getInt('parent_id'); 113 $this->setState('category.parent_id', $parentId); 114 115 // Load the User state. 116 $pk = (int) JRequest::getInt('id'); 117 $this->setState($this->getName() . '.id', $pk); 118 119 $extension = JRequest::getCmd('extension', 'com_content'); 120 $this->setState('category.extension', $extension); 121 $parts = explode('.', $extension); 122 123 // Extract the component name 124 $this->setState('category.component', $parts[0]); 125 126 // Extract the optional section name 127 $this->setState('category.section', (count($parts) > 1) ? $parts[1] : null); 128 129 // Load the parameters. 130 $params = JComponentHelper::getParams('com_categories'); 131 $this->setState('params', $params); 132 } 133 134 /** 135 * Method to get a category. 136 * 137 * @param integer $pk An optional id of the object to get, otherwise the id from the model state is used. 138 * 139 * @return mixed Category data object on success, false on failure. 140 * 141 * @since 1.6 142 */ 143 public function getItem($pk = null) 144 { 145 if ($result = parent::getItem($pk)) 146 { 147 148 // Prime required properties. 149 if (empty($result->id)) 150 { 151 $result->parent_id = $this->getState('category.parent_id'); 152 $result->extension = $this->getState('category.extension'); 153 } 154 155 // Convert the metadata field to an array. 156 $registry = new JRegistry(); 157 $registry->loadString($result->metadata); 158 $result->metadata = $registry->toArray(); 159 160 // Convert the created and modified dates to local user time for display in the form. 161 jimport('joomla.utilities.date'); 162 $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset')); 163 164 if (intval($result->created_time)) 165 { 166 $date = new JDate($result->created_time); 167 $date->setTimezone($tz); 168 $result->created_time = $date->toSql(true); 169 } 170 else 171 { 172 $result->created_time = null; 173 } 174 175 if (intval($result->modified_time)) 176 { 177 $date = new JDate($result->modified_time); 178 $date->setTimezone($tz); 179 $result->modified_time = $date->toSql(true); 180 } 181 else 182 { 183 $result->modified_time = null; 184 } 185 } 186 187 return $result; 188 } 189 190 /** 191 * Method to get the row form. 192 * 193 * @param array $data Data for the form. 194 * @param boolean $loadData True if the form is to load its own data (default case), false if not. 195 * 196 * @return mixed A JForm object on success, false on failure 197 * 198 * @since 1.6 199 */ 200 public function getForm($data = array(), $loadData = true) 201 { 202 // Initialise variables. 203 $extension = $this->getState('category.extension'); 204 $jinput = JFactory::getApplication()->input; 205 206 // A workaround to get the extension into the model for save requests. 207 if (empty($extension) && isset($data['extension'])) 208 { 209 $extension = $data['extension']; 210 $parts = explode('.', $extension); 211 212 $this->setState('category.extension', $extension); 213 $this->setState('category.component', $parts[0]); 214 $this->setState('category.section', @$parts[1]); 215 } 216 217 // Get the form. 218 $form = $this->loadForm('com_categories.category' . $extension, 'category', array('control' => 'jform', 'load_data' => $loadData)); 219 if (empty($form)) 220 { 221 return false; 222 } 223 224 // Modify the form based on Edit State access controls. 225 if (empty($data['extension'])) 226 { 227 $data['extension'] = $extension; 228 } 229 $user = JFactory::getUser(); 230 if (!$user->authorise('core.edit.state', $extension . '.category.' . $jinput->get('id'))) 231 { 232 // Disable fields for display. 233 $form->setFieldAttribute('ordering', 'disabled', 'true'); 234 $form->setFieldAttribute('published', 'disabled', 'true'); 235 236 // Disable fields while saving. 237 // The controller has already verified this is a record you can edit. 238 $form->setFieldAttribute('ordering', 'filter', 'unset'); 239 $form->setFieldAttribute('published', 'filter', 'unset'); 240 } 241 242 return $form; 243 } 244 245 /** 246 * A protected method to get the where clause for the reorder 247 * This ensures that the row will be moved relative to a row with the same extension 248 * 249 * @param JCategoryTable $table Current table instance 250 * 251 * @return array An array of conditions to add to add to ordering queries. 252 * 253 * @since 1.6 254 */ 255 protected function getReorderConditions($table) 256 { 257 return 'extension = ' . $this->_db->Quote($table->extension); 258 } 259 260 /** 261 * Method to get the data that should be injected in the form. 262 * 263 * @return mixed The data for the form. 264 * 265 * @since 1.6 266 */ 267 protected function loadFormData() 268 { 269 // Check the session for previously entered form data. 270 $data = JFactory::getApplication()->getUserState('com_categories.edit.' . $this->getName() . '.data', array()); 271 272 if (empty($data)) 273 { 274 $data = $this->getItem(); 275 } 276 277 return $data; 278 } 279 280 /** 281 * Method to preprocess the form. 282 * 283 * @param JForm $form A JForm object. 284 * @param mixed $data The data expected for the form. 285 * @param string $groups The name of the plugin group to import. 286 * 287 * @return void 288 * 289 * @see JFormField 290 * @since 1.6 291 * @throws Exception if there is an error in the form event. 292 */ 293 protected function preprocessForm(JForm $form, $data, $group = 'content') 294 { 295 jimport('joomla.filesystem.path'); 296 297 // Initialise variables. 298 $lang = JFactory::getLanguage(); 299 $extension = $this->getState('category.extension'); 300 $component = $this->getState('category.component'); 301 $section = $this->getState('category.section'); 302 303 // Get the component form if it exists 304 jimport('joomla.filesystem.path'); 305 $name = 'category' . ($section ? ('.' . $section) : ''); 306 307 // Looking first in the component models/forms folder 308 $path = JPath::clean(JPATH_ADMINISTRATOR . "/components/$component/models/forms/$name.xml"); 309 310 // Old way: looking in the component folder 311 if (!file_exists($path)) 312 { 313 $path = JPath::clean(JPATH_ADMINISTRATOR . "/components/$component/$name.xml"); 314 } 315 316 if (file_exists($path)) 317 { 318 $lang->load($component, JPATH_BASE, null, false, false); 319 $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false); 320 321 if (!$form->loadFile($path, false)) 322 { 323 throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); 324 } 325 } 326 327 // Try to find the component helper. 328 $eName = str_replace('com_', '', $component); 329 $path = JPath::clean(JPATH_ADMINISTRATOR . "/components/$component/helpers/category.php"); 330 331 if (file_exists($path)) 332 { 333 require_once $path; 334 $cName = ucfirst($eName) . ucfirst($section) . 'HelperCategory'; 335 336 if (class_exists($cName) && is_callable(array($cName, 'onPrepareForm'))) 337 { 338 $lang->load($component, JPATH_BASE, null, false, false) || $lang->load($component, JPATH_BASE . '/components/' . $component, null, false, false) || $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false) || $lang->load($component, JPATH_BASE . '/components/' . $component, $lang->getDefault(), false, false); 339 call_user_func_array(array($cName, 'onPrepareForm'), array(&$form)); 340 341 // Check for an error. 342 if ($form instanceof Exception) 343 { 344 $this->setError($form->getMessage()); 345 return false; 346 } 347 } 348 } 349 350 // Set the access control rules field component value. 351 $form->setFieldAttribute('rules', 'component', $component); 352 $form->setFieldAttribute('rules', 'section', $name); 353 354 // Trigger the default form events. 355 parent::preprocessForm($form, $data, $group); 356 } 357 358 /** 359 * Method to save the form data. 360 * 361 * @param array $data The form data. 362 * 363 * @return boolean True on success. 364 * 365 * @since 1.6 366 */ 367 public function save($data) 368 { 369 // Initialise variables; 370 $dispatcher = JDispatcher::getInstance(); 371 $table = $this->getTable(); 372 $pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState($this->getName() . '.id'); 373 $isNew = true; 374 375 // Include the content plugins for the on save events. 376 JPluginHelper::importPlugin('content'); 377 378 // Load the row if saving an existing category. 379 if ($pk > 0) 380 { 381 $table->load($pk); 382 $isNew = false; 383 } 384 385 // Set the new parent id if parent id not matched OR while New/Save as Copy . 386 if ($table->parent_id != $data['parent_id'] || $data['id'] == 0) 387 { 388 $table->setLocation($data['parent_id'], 'last-child'); 389 } 390 391 // Alter the title for save as copy 392 if (JRequest::getVar('task') == 'save2copy') 393 { 394 list($title, $alias) = $this->generateNewTitle($data['parent_id'], $data['alias'], $data['title']); 395 $data['title'] = $title; 396 $data['alias'] = $alias; 397 } 398 399 // Bind the data. 400 if (!$table->bind($data)) 401 { 402 $this->setError($table->getError()); 403 return false; 404 } 405 406 // Bind the rules. 407 if (isset($data['rules'])) 408 { 409 $rules = new JAccessRules($data['rules']); 410 $table->setRules($rules); 411 } 412 413 // Check the data. 414 if (!$table->check()) 415 { 416 $this->setError($table->getError()); 417 return false; 418 } 419 420 // Trigger the onContentBeforeSave event. 421 $result = $dispatcher->trigger($this->event_before_save, array($this->option . '.' . $this->name, &$table, $isNew)); 422 if (in_array(false, $result, true)) 423 { 424 $this->setError($table->getError()); 425 return false; 426 } 427 428 // Store the data. 429 if (!$table->store()) 430 { 431 $this->setError($table->getError()); 432 return false; 433 } 434 435 // Trigger the onContentAfterSave event. 436 $dispatcher->trigger($this->event_after_save, array($this->option . '.' . $this->name, &$table, $isNew)); 437 438 // Rebuild the path for the category: 439 if (!$table->rebuildPath($table->id)) 440 { 441 $this->setError($table->getError()); 442 return false; 443 } 444 445 // Rebuild the paths of the category's children: 446 if (!$table->rebuild($table->id, $table->lft, $table->level, $table->path)) 447 { 448 $this->setError($table->getError()); 449 return false; 450 } 451 452 $this->setState($this->getName() . '.id', $table->id); 453 454 // Clear the cache 455 $this->cleanCache(); 456 457 return true; 458 } 459 460 /** 461 * Method to change the published state of one or more records. 462 * 463 * @param array $pks A list of the primary keys to change. 464 * @param integer $value The value of the published state. 465 * 466 * @return boolean True on success. 467 * 468 * @since 2.5 469 */ 470 function publish(&$pks, $value = 1) 471 { 472 if (parent::publish($pks, $value)) { 473 // Initialise variables. 474 $dispatcher = JDispatcher::getInstance(); 475 $extension = JRequest::getCmd('extension'); 476 477 // Include the content plugins for the change of category state event. 478 JPluginHelper::importPlugin('content'); 479 480 // Trigger the onCategoryChangeState event. 481 $dispatcher->trigger('onCategoryChangeState', array($extension, $pks, $value)); 482 483 return true; 484 } 485 } 486 487 /** 488 * Method rebuild the entire nested set tree. 489 * 490 * @return boolean False on failure or error, true otherwise. 491 * 492 * @since 1.6 493 */ 494 public function rebuild() 495 { 496 // Get an instance of the table object. 497 $table = $this->getTable(); 498 499 if (!$table->rebuild()) 500 { 501 $this->setError($table->getError()); 502 return false; 503 } 504 505 // Clear the cache 506 $this->cleanCache(); 507 508 return true; 509 } 510 511 /** 512 * Method to save the reordered nested set tree. 513 * First we save the new order values in the lft values of the changed ids. 514 * Then we invoke the table rebuild to implement the new ordering. 515 * 516 * @param array $idArray An array of primary key ids. 517 * @param integer $lft_array The lft value 518 * 519 * @return boolean False on failure or error, True otherwise 520 * 521 * @since 1.6 522 */ 523 public function saveorder($idArray = null, $lft_array = null) 524 { 525 // Get an instance of the table object. 526 $table = $this->getTable(); 527 528 if (!$table->saveorder($idArray, $lft_array)) 529 { 530 $this->setError($table->getError()); 531 return false; 532 } 533 534 // Clear the cache 535 $this->cleanCache(); 536 537 return true; 538 } 539 540 /** 541 * Batch copy categories to a new category. 542 * 543 * @param integer $value The new category. 544 * @param array $pks An array of row IDs. 545 * @param array $contexts An array of item contexts. 546 * 547 * @return mixed An array of new IDs on success, boolean false on failure. 548 * 549 * @since 1.6 550 */ 551 protected function batchCopy($value, $pks, $contexts) 552 { 553 // $value comes as {parent_id}.{extension} 554 $parts = explode('.', $value); 555 $parentId = (int) JArrayHelper::getValue($parts, 0, 1); 556 557 $table = $this->getTable(); 558 $db = $this->getDbo(); 559 $user = JFactory::getUser(); 560 $extension = JFactory::getApplication()->input->get('extension', '', 'word'); 561 $i = 0; 562 563 // Check that the parent exists 564 if ($parentId) 565 { 566 if (!$table->load($parentId)) 567 { 568 if ($error = $table->getError()) 569 { 570 // Fatal error 571 $this->setError($error); 572 return false; 573 } 574 else 575 { 576 // Non-fatal error 577 $this->setError(JText::_('JGLOBAL_BATCH_MOVE_PARENT_NOT_FOUND')); 578 $parentId = 0; 579 } 580 } 581 // Check that user has create permission for parent category 582 $canCreate = ($parentId == $table->getRootId()) ? $user->authorise('core.create', $extension) : $user->authorise('core.create', $extension . '.category.' . $parentId); 583 if (!$canCreate) 584 { 585 // Error since user cannot create in parent category 586 $this->setError(JText::_('COM_CATEGORIES_BATCH_CANNOT_CREATE')); 587 return false; 588 } 589 } 590 591 // If the parent is 0, set it to the ID of the root item in the tree 592 if (empty($parentId)) 593 { 594 if (!$parentId = $table->getRootId()) 595 { 596 $this->setError($db->getErrorMsg()); 597 return false; 598 } 599 // Make sure we can create in root 600 elseif (!$user->authorise('core.create', $extension)) 601 { 602 $this->setError(JText::_('COM_CATEGORIES_BATCH_CANNOT_CREATE')); 603 return false; 604 } 605 } 606 607 // We need to log the parent ID 608 $parents = array(); 609 610 // Calculate the emergency stop count as a precaution against a runaway loop bug 611 $query = $db->getQuery(true); 612 $query->select('COUNT(id)'); 613 $query->from($db->quoteName('#__categories')); 614 $db->setQuery($query); 615 $count = $db->loadResult(); 616 617 if ($error = $db->getErrorMsg()) 618 { 619 $this->setError($error); 620 return false; 621 } 622 623 // Parent exists so we let's proceed 624 while (!empty($pks) && $count > 0) 625 { 626 // Pop the first id off the stack 627 $pk = array_shift($pks); 628 629 $table->reset(); 630 631 // Check that the row actually exists 632 if (!$table->load($pk)) 633 { 634 if ($error = $table->getError()) 635 { 636 // Fatal error 637 $this->setError($error); 638 return false; 639 } 640 else 641 { 642 // Not fatal error 643 $this->setError(JText::sprintf('JGLOBAL_BATCH_MOVE_ROW_NOT_FOUND', $pk)); 644 continue; 645 } 646 } 647 648 // Copy is a bit tricky, because we also need to copy the children 649 $query->clear(); 650 $query->select('id'); 651 $query->from($db->quoteName('#__categories')); 652 $query->where('lft > ' . (int) $table->lft); 653 $query->where('rgt < ' . (int) $table->rgt); 654 $db->setQuery($query); 655 $childIds = $db->loadColumn(); 656 657 // Add child ID's to the array only if they aren't already there. 658 foreach ($childIds as $childId) 659 { 660 if (!in_array($childId, $pks)) 661 { 662 array_push($pks, $childId); 663 } 664 } 665 666 // Make a copy of the old ID and Parent ID 667 $oldId = $table->id; 668 $oldParentId = $table->parent_id; 669 670 // Reset the id because we are making a copy. 671 $table->id = 0; 672 673 // If we a copying children, the Old ID will turn up in the parents list 674 // otherwise it's a new top level item 675 $table->parent_id = isset($parents[$oldParentId]) ? $parents[$oldParentId] : $parentId; 676 677 // Set the new location in the tree for the node. 678 $table->setLocation($table->parent_id, 'last-child'); 679 680 // TODO: Deal with ordering? 681 //$table->ordering = 1; 682 $table->level = null; 683 $table->asset_id = null; 684 $table->lft = null; 685 $table->rgt = null; 686 687 // Alter the title & alias 688 list($title, $alias) = $this->generateNewTitle($table->parent_id, $table->alias, $table->title); 689 $table->title = $title; 690 $table->alias = $alias; 691 692 // Store the row. 693 if (!$table->store()) 694 { 695 $this->setError($table->getError()); 696 return false; 697 } 698 699 // Get the new item ID 700 $newId = $table->get('id'); 701 702 // Add the new ID to the array 703 $newIds[$i] = $newId; 704 $i++; 705 706 // Now we log the old 'parent' to the new 'parent' 707 $parents[$oldId] = $table->id; 708 $count--; 709 } 710 711 // Rebuild the hierarchy. 712 if (!$table->rebuild()) 713 { 714 $this->setError($table->getError()); 715 return false; 716 } 717 718 // Rebuild the tree path. 719 if (!$table->rebuildPath($table->id)) 720 { 721 $this->setError($table->getError()); 722 return false; 723 } 724 725 return $newIds; 726 } 727 728 /** 729 * Batch move categories to a new category. 730 * 731 * @param integer $value The new category ID. 732 * @param array $pks An array of row IDs. 733 * @param array $contexts An array of item contexts. 734 * 735 * @return boolean True on success. 736 * 737 * @since 1.6 738 */ 739 protected function batchMove($value, $pks, $contexts) 740 { 741 $parentId = (int) $value; 742 743 $table = $this->getTable(); 744 $db = $this->getDbo(); 745 $query = $db->getQuery(true); 746 $user = JFactory::getUser(); 747 $extension = JFactory::getApplication()->input->get('extension', '', 'word'); 748 749 // Check that the parent exists. 750 if ($parentId) 751 { 752 if (!$table->load($parentId)) 753 { 754 if ($error = $table->getError()) 755 { 756 // Fatal error 757 $this->setError($error); 758 759 return false; 760 } 761 else 762 { 763 // Non-fatal error 764 $this->setError(JText::_('JGLOBAL_BATCH_MOVE_PARENT_NOT_FOUND')); 765 $parentId = 0; 766 } 767 } 768 // Check that user has create permission for parent category 769 $canCreate = ($parentId == $table->getRootId()) ? $user->authorise('core.create', $extension) : $user->authorise('core.create', $extension . '.category.' . $parentId); 770 if (!$canCreate) 771 { 772 // Error since user cannot create in parent category 773 $this->setError(JText::_('COM_CATEGORIES_BATCH_CANNOT_CREATE')); 774 return false; 775 } 776 777 // Check that user has edit permission for every category being moved 778 // Note that the entire batch operation fails if any category lacks edit permission 779 foreach ($pks as $pk) 780 { 781 if (!$user->authorise('core.edit', $extension . '.category.' . $pk)) 782 { 783 // Error since user cannot edit this category 784 $this->setError(JText::_('COM_CATEGORIES_BATCH_CANNOT_EDIT')); 785 return false; 786 } 787 } 788 } 789 790 // We are going to store all the children and just move the category 791 $children = array(); 792 793 // Parent exists so we let's proceed 794 foreach ($pks as $pk) 795 { 796 // Check that the row actually exists 797 if (!$table->load($pk)) 798 { 799 if ($error = $table->getError()) 800 { 801 // Fatal error 802 $this->setError($error); 803 return false; 804 } 805 else 806 { 807 // Not fatal error 808 $this->setError(JText::sprintf('JGLOBAL_BATCH_MOVE_ROW_NOT_FOUND', $pk)); 809 continue; 810 } 811 } 812 813 // Set the new location in the tree for the node. 814 $table->setLocation($parentId, 'last-child'); 815 816 // Check if we are moving to a different parent 817 if ($parentId != $table->parent_id) 818 { 819 // Add the child node ids to the children array. 820 $query->clear(); 821 $query->select('id'); 822 $query->from($db->quoteName('#__categories')); 823 $query->where($db->quoteName('lft' ) .' BETWEEN ' . (int) $table->lft . ' AND ' . (int) $table->rgt); 824 $db->setQuery($query); 825 $children = array_merge($children, (array) $db->loadColumn()); 826 } 827 828 // Store the row. 829 if (!$table->store()) 830 { 831 $this->setError($table->getError()); 832 return false; 833 } 834 835 // Rebuild the tree path. 836 if (!$table->rebuildPath()) 837 { 838 $this->setError($table->getError()); 839 return false; 840 } 841 } 842 843 // Process the child rows 844 if (!empty($children)) 845 { 846 // Remove any duplicates and sanitize ids. 847 $children = array_unique($children); 848 JArrayHelper::toInteger($children); 849 850 // Check for a database error. 851 if ($db->getErrorNum()) 852 { 853 $this->setError($db->getErrorMsg()); 854 return false; 855 } 856 } 857 858 return true; 859 } 860 861 /** 862 * Custom clean the cache of com_content and content modules 863 * 864 * @since 1.6 865 */ 866 protected function cleanCache($group = null, $client_id = 0) 867 { 868 $extension = JRequest::getCmd('extension'); 869 switch ($extension) 870 { 871 case 'com_content': 872 parent::cleanCache('com_content'); 873 parent::cleanCache('mod_articles_archive'); 874 parent::cleanCache('mod_articles_categories'); 875 parent::cleanCache('mod_articles_category'); 876 parent::cleanCache('mod_articles_latest'); 877 parent::cleanCache('mod_articles_news'); 878 parent::cleanCache('mod_articles_popular'); 879 break; 880 default: 881 parent::cleanCache($extension); 882 break; 883 } 884 } 885 886 /** 887 * Method to change the title & alias. 888 * 889 * @param integer $parent_id The id of the parent. 890 * @param string $alias The alias. 891 * @param string $title The title. 892 * 893 * @return array Contains the modified title and alias. 894 * 895 * @since 1.7 896 */ 897 protected function generateNewTitle($parent_id, $alias, $title) 898 { 899 // Alter the title & alias 900 $table = $this->getTable(); 901 while ($table->load(array('alias' => $alias, 'parent_id' => $parent_id))) 902 { 903 $title = JString::increment($title); 904 $alias = JString::increment($alias, 'dash'); 905 } 906 907 return array($title, $alias); 908 } 909 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |