• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Modern AAC][Using the MVC] Support list

Hultin

Member
Joined
Dec 2, 2008
Messages
262
Reaction score
17
Hello, I've seen alot of people not properly using the MVC modell, it's there why not use it?

Here is my support list, you will have to style it yourself.

supports_model.php (Model)

PHP:
<?php
/* 
 Copyright Johan Hultin
 
 Please don't remove this copyright information
 
 You are free to edit, change and update the following code freely.
*/
class supports_model extends model {
	public function getSupport(){
		require("config.php");
		$this->load->database();
		$sql = $this->db->query("SELECT `name`, `online`, `group_id` FROM `players` WHERE group_id >= 3");
		$ret["ammount"] = $sql->num_rows;
		$ret["support"] = $sql->result_array();
		return $ret;
	}
}
?>
Support.php (Controller)
PHP:
<?php
/* 
 Copyright Johan Hultin
 
 Please don't remove this copyright information
 
 You are free to edit, change and update the following code freely.
*/

class support extends Controller {
	public function index(){
		$this->load->model("supports_model");
		$data = array();
		$data["support"] = $this->supports_model->getSupport();
		
		$this->load->view("support", $data);
	}
	
}
?>

support.php (VIEW)

PHP:
<?php
require("config.php");
$ide = new IDE;
try { $ide->loadInjections("support"); }catch(Exception $e) { error($e->getMessage());}
$groups = array(3 => 'Tutor', 4 => 'Senior Tutor', 5 => 'Community master', 6 => 'GOD');
echo '<h1>Support list</h1><ul>';
foreach($support['support'] as $val){
	if($val['online'] == true){
		$online = '<span class="green">Online</span>';
	} else {
		$online = '<span class="red">Offline</span>';
	}
	echo '<li class="support-position fl">'.$groups[$val["group_id"]].'</li>
		  <li class="support-name fl">'.$val['name'].'</li>
		  <li class="support-online fl">'.$online.'</li>';
}
echo '<div class="fc"></div></ul>';
?>
 
Last edited by a moderator:
Hehe, thanks for the comment. I know you tend to be harsch so I'm flattered.

Yours, Hultin.
 
Um, how do I edit? it seems that parts of the original post has been posted twice for some reason
 
Dang, that stinks. I guess I'll post the view here then.

support.php (VIEW)

PHP:
<?php
require("config.php");
$ide = new IDE;
try { $ide->loadInjections("support"); }catch(Exception $e) { error($e->getMessage());}
$groups = array(3 => 'Tutor', 4 => 'Senior Tutor', 5 => 'Community master', 6 => 'GOD');
echo '<h1>Support list</h1><ul>';
foreach($support['support'] as $val){
	if($val['online'] == true){
		$online = '<span class="green">Online</span>';
	} else {
		$online = '<span class="red">Offline</span>';
	}
	echo '<li class="support-position fl">'.$groups[$val["group_id"]].'</li>
		  <li class="support-name fl">'.$val['name'].'</li>
		  <li class="support-online fl">'.$online.'</li>';
}
echo '<div class="fc"></div></ul>';
?>
 
I've edited your first post. You cannot edit your own posts as long as you are not a premium user.
 
Ah, I see. Well, thanks for editing it :) Also, I just now discovered that you're one of the authors of modern AAC, I therefore would like to thank you for making me able to forget the nightmare that is Geisor AAC or the hardwork of building my own AAC, which I could do but this really saves me a ton of time, so thanks!
 
Ah, I see. Well, thanks for editing it :) Also, I just now discovered that you're one of the authors of modern AAC, I therefore would like to thank you for making me able to forget the nightmare that is Geisor AAC or the hardwork of building my own AAC, which I could do but this really saves me a ton of time, so thanks!

Hi, thanks for good words, there is Modern AAC v2 in development already in public SVN, you might be more interested in developing for this platform as this is more likely the future of Modern AAC and the current scripts will not work on the new one. The code is much much more cleaner.
 
I did notice that, and I did a quick look around and I'll probably dig into it deeper tommorow or within the next week for sure, what verison of codeigniter (or other MVC based framework) is it running on as the current modernaac's CI is very, very outdated :p
 
I did notice that, and I did a quick look around and I'll probably dig into it deeper tommorow or within the next week for sure, what verison of codeigniter (or other MVC based framework) is it running on as the current modernaac's CI is very, very outdated :p

It is using still the same Codeigniter framework, but a lot of things has been changed and added libraries such as ORM. Development on a new version is much faster cleaner and safer, all possible functions are already provided and no need of writing SQL code.
 
Should be noted, this is for people who are willing to learn how to mvc works to some extent.

I shall have a look in a a minute Paxton, but sounds promising.

Past -> view/modell/controller into their coresponding folder in your webservers directory (application and some levels deeper)
 
i put all on coresponding folders but i can see support list on website i need configure config.php????

why cant see a link support list on cumunity links?

i can se (houses,forum,characters,deathlist etc..)

sry mi english..
i rep ++ for help
 
What do you mean why? Maybe you have other group names in your server? Just change the groups.xml and it'll be edited in the website too.
This way, you'll have to edited both the php(view) and groups.xml.
It doesn't really matter, but it was just me idea.

Ah, I see.
 
Back
Top