Jump to content

TheOnlyDroid

Clients
  • Posts

    30
  • Joined

  • Last visited

 Content Type 

Profiles

Downloads

IPS4 Providers

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Forums

Store

Everything posted by TheOnlyDroid

  1. The namespace was changed, as suggested. <?php namespace IPS\avovix\personal; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } class _Request extends \IPS\Patterns\ActiveRecord { Class 'IPS\avovix\personal\Request' not found Error thrown with message "Class 'IPS\avovix\personal\Request' not found" Stacktrace: #6 Error in C:\xampp\htdocs\ipboardx\applications\avovix\tasks\DataPackages.php:39 #5 IPS\avovix\tasks\_DataPackages:execute in C:\xampp\htdocs\ipboardx\system\Task\Task.php:248 #4 IPS\_Task:run in C:\xampp\htdocs\ipboardx\applications\core\modules\admin\settings\advanced.php:630 #3 IPS\core\modules\admin\settings\_advanced:runTask in C:\xampp\htdocs\ipboardx\system\Dispatcher\Controller.php:85 #2 IPS\Dispatcher\_Controller:execute in C:\xampp\htdocs\ipboardx\applications\core\modules\admin\settings\advanced.php:34 #1 IPS\core\modules\admin\settings\_advanced:execute in C:\xampp\htdocs\ipboardx\system\Dispatcher\Dispatcher.php:146 #0 IPS\_Dispatcher:run in C:\xampp\htdocs\ipboardx\admin\index.php:14 <?php /** * @brief DataPackages Task * @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a> * @copyright (c) Invision Power Services, Inc. * @license https://www.invisioncommunity.com/legal/standards/ * @package Invision Community * @subpackage avovix * @since 30 Sep 2018 */ namespace IPS\avovix\tasks; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } /** * DataPackages Task */ class _DataPackages extends \IPS\Task { /** * Execute * * If ran successfully, should return anything worth logging. Only log something * worth mentioning (don't log "task ran successfully"). Return NULL (actual NULL, not '' or 0) to not log (which will be most cases). * If an error occurs which means the task could not finish running, throw an \IPS\Task\Exception - do not log an error as a normal log. * Tasks should execute within the time of a normal HTTP request. * * @return mixed Message to log or NULL * @throws \IPS\Task\Exception */ public function execute() { foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'avovix_datarequests', array('r_status=?', \IPS\avovix\personal\Request::STATUS_PENDING )), 'IPS\avovix\personal\Request' ) as $request) { } } /** * Cleanup * * If your task takes longer than 15 minutes to run, this method * will be called before execute(). Use it to clean up anything which * may not have been done * * @return void */ public function cleanup() { } }
  2. As mentioned prior to your response; It doesn't make a difference the result (I.E: the error) is still the same.
  3. Well that's the issue, regardless of where, what or how the file is written, read; The issue remains the same; It still has no idea where it/what it is.
  4. Error thrown with message "Class 'IPS\avovix\Request' not found" Stacktrace: #6 Error in C:\xampp\htdocs\ipboardx\applications\avovix\tasks\DataPackages.php:47 #5 IPS\avovix\tasks\_DataPackages:execute in C:\xampp\htdocs\ipboardx\system\Task\Task.php:248 #4 IPS\_Task:run in C:\xampp\htdocs\ipboardx\applications\core\modules\admin\settings\advanced.php:630 #3 IPS\core\modules\admin\settings\_advanced:runTask in C:\xampp\htdocs\ipboardx\system\Dispatcher\Controller.php:85 #2 IPS\Dispatcher\_Controller:execute in C:\xampp\htdocs\ipboardx\applications\core\modules\admin\settings\advanced.php:34 #1 IPS\core\modules\admin\settings\_advanced:execute in C:\xampp\htdocs\ipboardx\system\Dispatcher\Dispatcher.php:146 #0 IPS\_Dispatcher:run in C:\xampp\htdocs\ipboardx\admin\index.php:14 Folder Structure
  5. For some reason, while running a task its unable to find the class '\IPS\avovix\Request' when running a foreach loop with an ActiveRecordIterator namespace IPS\avovix; /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' ); exit; } class _Request extends \IPS\Patterns\ActiveRecord { const STATUS_PENDING = 'pend'; const STATUS_COMPLETED = 'comp'; const STATUS_FAILED = 'fail'; /** * @brief Multiton Store */ protected static $multitons; /** * @brief Database Table */ public static $databaseTable = 'avovix_datarequests'; /** * @brief Database Prefix */ public static $databasePrefix = 'r_'; public static function loadAndCheckPerms( $id ) { $obj = static::load( $id ); if ( !$obj->canView() ) { throw new \OutOfRangeException; } return $obj; } public function setDefaultValues() { $this->status = static::STATUS_PENDING; $this->date = new \IPS\DateTime; $this->_data['member'] = 0; } /** * @brief Member */ protected $_member; public function get_member() { if ( $this->_member === NULL ) { try { $this->_member = \IPS\Member::load($this->_data['member']); if ( !$this->_member->member_id ) { throw new \OutOfRangeException; } } catch ( \OutOfRangeException $e ) { } } return $this->_member; } /** * Set member * * @param \IPS\Member * @return void */ public function set_member( \IPS\Member $member ) { $this->_data['member'] = (int) $member->member_id; $this->_member = NULL; } /** * Get date * * @return \IPS\DateTime */ public function get_date() { return \IPS\DateTime::ts( $this->_data['date'] ); } /** * Set date * * @param \IPS\DateTime $date The invoice date * @return void */ public function set_date( \IPS\DateTime $date ) { $this->_data['date'] = $date->getTimestamp(); } } class _DataPackages extends \IPS\Task { /** * Execute * * If ran successfully, should return anything worth logging. Only log something * worth mentioning (don't log "task ran successfully"). Return NULL (actual NULL, not '' or 0) to not log (which will be most cases). * If an error occurs which means the task could not finish running, throw an \IPS\Task\Exception - do not log an error as a normal log. * Tasks should execute within the time of a normal HTTP request. * * @return mixed Message to log or NULL * @throws \IPS\Task\Exception */ public function execute() { $processedDate = \IPS\DateTime::create(); /* foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'avovix_datarequests', array( 'r_status=?', 'pend', 'r_date ASC', 100 )), 'IPS\avovix\Request' ) as $request ) { \IPS\Session::i()->log( 'avovix_test_log' ); }*/ foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'avovix_datarequests', array( 'r_status=?', \IPS\avovix\Request::STATUS_PENDING ), 'r_date ASC', 100), '\IPS\avovix\Request' ) as $request ) { } } /** * Cleanup * * If your task takes longer than 15 minutes to run, this method * will be called before execute(). Use it to clean up anything which * may not have been done * * @return void */ public function cleanup() { } }
  6. Coolio, thanks for the help buddy; Much appreciated.
  7. Yeah sorry about that.. Basically, I want to add the Parent Item and the Children to the navigation upon install, without having to go through and create the menu item's manually; As that'll become a massive pain in the ass once I've got the project to the point where I'm happy with it and deploy it on our server for official use.
  8. Hey TheJackal84, I neglected to mention that the code provided is in the Application.php of the App. class _Application extends \IPS\Application { /** * [Node] Get Icon for tree * * @note Return the class for the icon (e.g. 'globe') * @return string|null */ protected function get__icon() { return 'info-circle'; } /** * Default front navigation * * @code // Each item... array( 'key' => 'Example', // The extension key 'app' => 'core', // [Optional] The extension application. If ommitted, uses this application 'config' => array(...), // [Optional] The configuration for the menu item 'title' => 'SomeLangKey', // [Optional] If provided, the value of this language key will be copied to menu_item_X 'children' => array(...), // [Optional] Array of child menu items for this item. Each has the same format. ) return array( 'rootTabs' => array(), // These go in the top row 'browseTabs' => array(), // These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist) 'browseTabsEnd' => array(), // These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist) 'activityTabs' => array(), // These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist) ) * @endcode * @return array */ public function defaultFrontNavigation() { return array( 'rootTabs' => array( array( 'key' => 'Multimart', 'children' => array( array( 'app' => 'core', 'key' => 'Menu', 'title' => 'frontnavigation_multimart_complaints', 'children' => array( array( 'key' => 'MyComplaints' ), array( 'key' => 'OpenComplaints' ), array( 'key' => 'ClosedComplaints' ), ) ) ), ) ), 'browseTabs' => array(), 'browseTabsEnd' => array(), 'activityTabs' => array() ); } }
  9. Bare with me here, I haven't touched IPS in a long time... So I'm not even sure if I'm doing it right, however some clarification would be greatly appreciated; So I'm assuming that adding the FrontNavigation default's for the application is done with defaultFrontNavigation() but I'm more than likely completely wrong.. public function defaultFrontNavigation() { return array( 'rootTabs' => array( array( 'key' => 'Multimart', 'children' => array( array( 'app' => 'core', 'key' => 'Menu', 'title' => 'frontnavigation_multimart_complaints', 'children' => array( array( 'key' => 'MyComplaints' ), array( 'key' => 'OpenComplaints' ), array( 'key' => 'ClosedComplaints' ), ) ) ), ) ), 'browseTabs' => array(), 'browseTabsEnd' => array(), 'activityTabs' => array() ); }
  10. Welcome, I'm still trying to get some cash to buy my own License. But welcome either way.
×
×
  • Create New...