HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


To-Do List in Admin Center

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#963 (In Topic #239)

Fan in action

To-Do List in Admin Center

This modification of the admin center's front page will turn it into this:

Works in ocPortal 1.0, 1.01 and 1.02.



You can skip my brilliant ingenious instructions (:rolleyes:) by downloading the file right now.

Make sure you do the following:

1) Place the modified start.php into your /admincenter/custom/ folder on your server.

2) Again, in /admincenter/ make a folder and call it anything (example: /admincenter/myfolder/)

2.1) Place a text file called anything and in the newly created folder and give it a 666 permission setting. (example: /admincenter/myfolder/myfile.txt)

Edit start.php and look somewhat at the bottom for "Administrative notes".

Change this to match what you chose as the filename and the folder name.

Code

$filename="somefolder/somefile.txt";

Now on to the download ;)

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#965

Fan in action

Code

<?php echo date("l, F jS Y @ g:i A",time()-60*60*5+60*60); ?>

This is set to show EST time on GMT servers.

You'll have to find the proper balance for your time zone.

60*60 = 1 hour
*5 = 60 seconds times 60 = 1 hour times 5 = 5 hours
+60*60 = add on an hour

The front - is so it removes an hour for DST

Code

<strong><u>Tasks Todo:</u></strong><br />
<?php
$baseurl=get_base_url()."/";
$theme=get_theme();
$moderate_gifts=1;
$done_iotd=0;
$done_poll=0;
$done_fotw=0;
$done_news=0;
$done_text=0;
$done_subm=0;
$done_gift=0;

Those are used in the entire "tasks todo" section.

Base Url > Basicly, it turns the installation path of ocPortal into a variable. Example: http://www.domain.com/~username/ would be "base_url"… the "root" of ocPortal, to be specific… ;)

Theme > Gets the Theme folder name, again, for the bullets…

Moderate_Gifts > If set to 1, you'll have a "to do" item whenever someone gives points to someone else. This doesn't monitor automated transactions such as for submitting files…

done_something > If 1, then the item was done. 0 means it wasn't done/has yet to be done. This will be calculated at the end and make a "All Tasks Done" item if everything was done…
Example, say the IOTD needs updating, then the done_iotd would be 0 ;)
 > done_text = Flagrant Text
 > done_subm = Unvalidated Items/Submissions
 > done_gift = Gift Transactions…

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#966

Fan in action

This is generalised, look for stuff like $days or $hours <= or >=

Code

{
   &#036;date=get_query_value_null_ok&#40;&#34;SELECT `Date` FROM `ocp_iotd` WHERE validated=&#39;1&#39;&#34;&#41;;
   if &#40;&#33;isset&#40;&#036;date&#41;&#41; &#036;hours=&#34;&#40;never&#41;&#34;; else &#036;hours=round&#40;&#40;time&#40;&#41;-&#036;date&#41;/60/60&#41;;
   if &#40;&#036;hours&#62;=25&#41; echo &#34;&#60;IMG SRC=&#39;{&#036;base_url}/themes/{&#036;theme}/b_empty.gif&#39;&#62;&nbsp;&#60;A HREF=&#39;&#34;.build_url&#40;array&#40;&#34;page&#34;=&#62;&#34;iotd&#34;,&#34;type&#34;=&#62;&#34;choose&#34;&#41;,&#34;admincenter&#34;&#41;.&#34;&#39;&#62;Update IOTD&#60;/A&#62; &#91;&#34;.get_num_iotd&#40;&#41;.&#34; waiting&#93;&#60;br /&#62;&#34;;
   if &#40;&#036;hours&#60;=24&#41; &#036;done_iotd=1;
}

This means:
  • If the IOTD was set 25 hours (or more) ago, we should mark it "to do"
  • If the IOTD was set 24 hours (or less) ago, then we should set $done_iotd to 1 as it was done.

This applies for all other items except for the Flagrant Text. So we'll skip right to it (flagrant text)

…. more stuff (IOTD, FOTW, POLL, NEWS, SUBMISSIONS) ….

Flagrant Text: (this has been re-done to work "better" than my previous start.php)

Code

// Flagrant
 &nbsp; &#036;textq = get_num_text_queue&#40;&#41;;
 &nbsp; &#036;done_text = 1;

 &nbsp; &#036;date=get_query_value_null_ok&#40;&#34;SELECT `time` FROM `ocp_values` WHERE name=&#39;flagrant&#39;&#34;&#41;;
 &nbsp; if &#40;isset&#40;&#036;date&#41;&#41;
 &nbsp; {
 &nbsp; &nbsp; &nbsp;&#036;time_should=get_query_value_null_ok&#40;&#34;SELECT `Days` FROM `ocp_text` WHERE `ActivationTime`=&#39;&#036;date&#39;&#34;&#41;;
 &nbsp; &nbsp; &nbsp;if &#40;isset&#40;&#036;time_should&#41;&#41;
 &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; &nbsp; &#036;time_had=time&#40;&#41;-&#036;date;
 &nbsp; &nbsp; &nbsp; &nbsp; &#036;days=round&#40;&#036;time_should-&#036;time_had/60/60/24,1&#41;;
 &nbsp; &nbsp; &nbsp;} else &#036;days=&#34;unknown&#34;;
 &nbsp; }
 &nbsp; if &#40;&#036;days &#60;= 0&#41; &#036;textt = 1;
 &nbsp; if &#40;&#036;textq &#33;= 0 && &#036;textt == 1&#41; {
 &nbsp; &nbsp; echo &#34;&#60;IMG SRC=&#39;{&#036;base_url}/themes/{&#036;theme}/b_empty.gif&#39;&#62;&nbsp;&#60;A HREF=&#39;&#34;.build_url&#40;array&#40;&#34;page&#34;=&#62;&#34;flagrant&#34;&#41;,&#34;admincenter&#34;&#41;.&#34;&#39;&#62;Update Flagrant Text&#60;/A&#62; &#91;&#34;.get_num_text_queue&#40;&#41;.&#34; waiting&#93;&#60;br /&#62;&#34;;
 &nbsp; &nbsp; &#036;done_text = 0;
 &nbsp; &nbsp;}
 &nbsp; if &#40;&#036;textq == 0 && &#036;textt == 1&#41; {
 &nbsp; &nbsp; echo &#34;&#60;IMG SRC=&#39;{&#036;base_url}/themes/{&#036;theme}/b_empty.gif&#39;&#62;&nbsp;&#60;A HREF=&#39;&#34;.build_url&#40;array&#40;&#34;page&#34;=&#62;&#34;flagrant&#34;&#41;,&#34;admincenter&#34;&#41;.&#34;&#39;&#62;Reset Flagrant Text&#60;/A&#62; &#91;Ran &#036;days days&#93;&#60;br /&#62;&#34;;
 &nbsp; &nbsp; &#036;done_text = 0;
 &nbsp; &nbsp;}

$textq > We use this variable to hold the number of flagrant texts in the queue (purchased via the point store)

$textt > This gets set to 1 if the ammount of days is or is less than 0. This is used so that we get a "should manage" to-do item, for those who want to set some sort of "your message here via the point store" text message…

$done_text = 1 > We use this here now since the code below modifies it so that if we have one in the queue, done_text will be set to 0. If there aren't any in the queue, then its done….

Code

if &#40;&#036;textq &#33;= 0 && &#036;textt == 1&#41; { .................

If there's something in the queue and the current text has done its time, then we should let you know that it needs to be updated. done_text gets set to 0.

Code

if &#40;&#036;textq == 0 && &#036;textt == 1&#41; { ..........

If we don't have flagrant text in the queue but the current one has done its time, then make sure we're told to update the flagrant text. For those who want that "your message here via the point store" thing…..

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#967

Fan in action

This moderates the gift transaction and let's us know if we had any transactions today. Ofcourse, this is where the "$moderate_gifts" comes in ;)

If you've set it to 0, then this won't be done. But done_gift gets marked so it doesn't screw up the "everything is done" section ;)

Code

// Points Transactions

if &#40;&#036;moderate_gifts==0&#41; { &#036;done_gift = 1; &#036;points_total = DISABLED;}
if &#40;&#036;moderate_gifts==1&#41; {

 &nbsp; &#036;points_time = time&#40;&#41;-24*60*60;
 &nbsp; &#036;points_total = get_query_value_null_ok&#40;&#34;SELECT count&#40;*&#41; FROM `ocp_gifts` WHERE `from` &#33;= &#39;0&#39; AND `datetime` &#62; &#39;&#036;points_time&#39;&#34;&#41;;
 &nbsp;
 &nbsp; //If the date was never empty, that means it was never set.
 &nbsp; if &#40;&#036;points_total == 0&#41; &#036;done_gift = 1;
 &nbsp; if &#40;&#036;points_total &#33;= 0&#41; {
 &nbsp;&#036;done_gift = 0;
 &nbsp;echo &#34;&#60;IMG SRC=&#39;{&#036;base_url}/themes/{&#036;theme}/b_empty.gif&#39;&#62;&nbsp;&#60;A HREF=&#39;&#34;.build_url&#40;array&#40;&#34;page&#34;=&#62;&#34;gifts&#34;&#41;,&#34;admincenter&#34;&#41;.&#34;&#39;&#62;Moderate Transactions&#60;/A&#62; &#91;&#036;points_total transaction&#40;s&#41; today&#93; &#60;br /&#62;&#34;;
   }
 &nbsp; }

Points total = number of transactions. points_time = check (daily) for transactions.



Code

// Tasks Complete?
 &nbsp; &#036;wedone = &#036;done_iotd + &#036;done_poll + &#036;done_fotw + &#036;done_news + &#036;done_text + &#036;done_subm + &#036;done_gift;
 &nbsp; if&#40;&#036;wedone == 7&#41; echo &#34;&#60;IMG SRC=&#39;{&#036;base_url}/themes/{&#036;theme}/b_full.gif&#39;&#62;&nbsp;All Tasks Complete&#60;br /&#62;

This basicly adds up every done_something to total up as 7, when its 7 we say that everything was done. ;)

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#968

Fan in action

BEHOLD! THE ALL MIGHTY DEBUG FANCY-DANDY SYSTEM! 1.0, all rights reserved  :rolleyes:  :lol:  :P  ;)

Code

// Check Values &#40;trouble-shooting&#41;
 &nbsp; &#036;debug = 0; &nbsp;// Should we list all that stuff under here?

 &nbsp; if&#40;&#036;debug == 1&#41; {
 &nbsp; &nbsp;echo &#34;&#60;br /&#62;
   &#60;TABLE WIDTH=&#39;75%&#39; HEIGHT=&#39;19&#39; BORDER=&#39;1&#39;&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;VARIABLE
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;SETTING
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;DESCRIPTION
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Are We Done?
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;wedone
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;7 = Everything is done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;IOTD Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_iotd
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Poll Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_poll
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;FOTW Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_fotw
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;News Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_news
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Flagrant Text Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_text
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Submitted Content Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_iotd
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Moderate Transactions?
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;moderate_gifts
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = moderate, 0 = don&#39;t moderate
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Gift Transactions Status
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;done_gift
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
 &nbsp; &nbsp;&#60;TR&#62;
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;Number of Transactions today
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;02%&#39; HEIGHT=&#39;19&#39;&#62;&#036;points_total
 &nbsp; &nbsp; &nbsp; &nbsp;&#60;TD WIDTH=&#39;05%&#39; HEIGHT=&#39;19&#39;&#62;1 = done, 0 = not done
 &nbsp; &nbsp;&#60;/TR&#62;
   &#60;/TABLE&#62;
 &nbsp; &nbsp;&#34;;
 &nbsp; &nbsp;}
?&#62;&#60;br /&#62;

That is somewhat large, what is does is this: It's very useful, especially if you're modifiying the code. I left it in incase someone needs it. if $debug is 0, it won't show up. if its 1, it will show up.

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#969

Fan in action

Here are the bullets I use in my skins:
Place these (or any others) in each of your theme folders.

b_full.gif must be (unless you change the filenames in start.php ;)) for completed items.

b_empty.gif must be (again.. unless blah blah start.php) for items that haven't been done.


ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#970

Fan in action

Please feel free to post any questions in this topic including problems such as "bug" reports related to this modification...

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#973
phT
Avatar

Fan in training

If I have Unvalidated items, does it show Unvalidated as Red?

And {$base_url} is not so good, because my site is: {$base_url}/~username/sitename, so it should do some kind of check of start.php from OcPortal root folder…
Back to the top
 
Posted
Rating:
#974
Avatar

I haven't used this mod, but base_url should be the path right to the ocportal installation, not just the domain.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#975

Fan in action

Updated the 2nd reply/page/thing :lol: :)

Here's an idea. :lol: I'll add base url to my debug table thingy-ma-jig :lol:

I'll re-release this mod soon…

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#978

Fan in action

Re-released it. Adds that base url value to the debug section ;)

Thats the only change in this new file.

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#983
phT
Avatar

Fan in training

Ok, thanks!
Now I don't need to edit the whole file to get it working… This is great mod, I can see what I need to do straight from the admin panel :)
Back to the top
 
Posted
Rating:
#985

Fan in action

Yup :)

Ofcourse, I have no problems if you editing it ;)
I want to encourage people to learn php and experiment with it. Just make sure to backup the "original" files (by original, I mean both the original ocportal one and a un-modified version of this mod).

You can also modify the option of having the gift transaction being displayed. One of the posts above explains how to do that :lol:


Also, if you have any suggestions about this mod, please let me know ;)

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: