Since Pagesetter has the ability to accept an expiration date for publications, I'm wondering if it is possible to do so using pgForm. I know I can use some Smarty tricks to come up with pretty much any date I want -- the goal is to provide an expire date of 90 days after the publication is created -- but I can handle getting that part.
What I need help with is how to submit the date using pgForm into the Pagesetter publication. I'm assuming I'd need to use a hidden input field, but I'm not sure what to name it, how to format it and if pgForm can even do that.
Edit: I'm sorry, I put this in the wrong category. Could someone be a dear and move it for me please?
edited by: Wendell, Jul 16, 2009 - 04:22 PM
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- rgasch created topic »Using PageUtil::addVar() to load script code« 11:48 AM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
[pgForm] Storing Expiration Date
-
- Rank: Freshman
- Registered: Dec 30, 2006
- Last visit: Apr 20, 2010
- Posts: 58
Hi
I have in Pagesetter :
Pub type "classified"
Workflow:
Code
<action id="submit">
<title>Zapisz 3dni</title>
<description>Zapisz ogloszenie na 3 dni </description>
<permission>author</permission>
<nextState>approved</nextState>
<operation online="1" days="3">changeExpired</operation>
operation:
Code
function pagesetter_operation_changeExpired(&$publication, &$core, &$args)
{
$online = (isset($args['ONLINE']) ? $args['ONLINE'] : 0);
$publication['core_online'] = $online;
$days = (isset($args['DAYS']) ? $args['DAYS'] : 30);
$days = date('Y-m-d',mktime(0, 0, 0, date("m") , date("d")+ $days, date("Y")));
$publication['core_expireDate'] = $days;
$result = pnModAPIFunc( 'pagesetter',
'edit',
'createPub',
array( 'tid' => $core['tid'],
'pubData' => $publication) );
And it was working people are submiting pubs with expire date 3 days or 7 days after creating
Other pubtype with this feature is companies catalogue:
Now in pagemaster:
workflow (I still have problem with it)...
Code
<!-- From initial state -->
<action id="submit">
<title>_PAGEMASTER_COMP_SUBMIT</title>
<description>Wysyla zawartosc do sprawdzenia przez moderatora</description>
<permission>comment</permission>
<nextState>waiting</nextState>
<operation>createPub</operation>
</action>
<action id="approve">
<title>_PAGEMASTER_COMP_SUBMIT_APPROVE</title>
<description>Wysyla i akceptuje</description>
<permission>moderator</permission>
<nextState>approved</nextState>
<operation online="1">createPub</operation>
</action>
<!-- State: waiting -->
<action id="update">
<title>_PAGEMASTER_WSA_UPDATE</title>
<description>Update content and approve for immediate publishing</description>
<permission>moderator</permission>
<state>waiting</state>
<operation>updatePub</operation>
</action>
<action id="update183w">
<title>_PAGEMASTER_WSA_UPDATE7_APROVE</title>
<description>Zapisz ogloszenie na 7 dni </description>
<permission>editor</permission>
<state>waiting</state>
<nextState>approved</nextState>
<operation online="1" days="183">updateExpireDate</operation>
</action>
<action id="update365w">
<title>_PAGEMASTER_WSA_UPDATE365_APROVE</title>
<description>Zapisz na rok</description>
<permission>editor</permission>
<state>waiting</state>
<nextState>approved</nextState>
<operation online="1" days="365">updateExpireDate</operation>
</action>
<action id="deletewaiting">
<title>_PAGEMASTER_WSA_UPDATE_DELETE</title>
<description>Delete publication</description>
<permission>editor</permission>
<state>waiting</state>
<operation>deletePub</operation>
</action>
operation pagemaster_operation_createPubWithExpireDate
Code
// set the online value if set
$obj['core_online'] = isset($params['online']) ? (int)$params['online'] : 0;
// find a new pid
$maxpid = DBUtil::selectFieldMax($obj['__WORKFLOW__']['obj_table'], 'core_pid', 'MAX');
$obj['core_pid'] = $maxpid + 1;
// assign the author
$obj['core_author'] = pnUserGetVar('uid');
//assign expiredate
$days = isset($params['days']) ? (int)$params['days'] : 30;
$days = date('Y-m-d',mktime(0, 0, 0, date("m") , date("d")+ $days, date("Y")));
$obj['core_expiredate'] = $days;
// save the object
$obj = DBUtil::insertObject($obj, $obj['__WORKFLOW__']['obj_table'], 'id')
Now I moved all that stuff to pagemaster and it is working :) but not everything is as it was in Pagesetter.
First is on publist user who posted company he and admin are able to see it on the list (state waiting online = 0)
then there is a full view link with pid and it is directing to a full view... then in full view I have edit link with pid witch is working for accepted but is not working for those in waiting state it is saing missing pid
so to make everything working similar to what it was in Pagesetter I have to add if statment in template like that:
Code
<!--[if $core_online == "1" ]-->
<li><a href="<!--[pnmodurl modname='pagemaster' type='user' func='pubedit' tid=$core_tid pid=$core_pid]-->"><!--[pnml name='_EDIT']--></a></li>
<!--[elseif $core_online == "0" ]-->]
<li><a href="<!--[pnmodurl modname='pagemaster' type='user' func='pubedit' tid=$core_tid id=$id]-->"><!--[pnml name='_EDIT']--></a></li>
<!--[/if]-->
I dont know if it is for a reason I is quite cool because pubs whitch are offline I can make highlited for a user to do some action for example show paypal link :P
HEHEE now I read what you asking....
Marry Jane
edited by: Kaik, Jul 17, 2009 - 10:18 AM
--
rgfdgafgaf -
- Rank: Developer
- Registered: Feb 17, 2005
- Last visit: May 21, 2010
- Posts: 684
Wendell
What I need help with is how to submit the date using pgForm into the Pagesetter publication. I'm assuming I'd need to use a hidden input field, but I'm not sure what to name it, how to format it and if pgForm can even do that.
Hi Wendell,
Had that on my wish list as well. I've created a ticket: http://code.zikula.org/dits/ticket/41
- Moderated by:
- Support
