";
});
});
}
else if(view==="course"&&cId){
var cx=null;DB.forEach(function(x){if(x.id===cId)cx=x;});
if(!cx){window.location.href="?cf=explore";return;}
var tC=getTpl("course");
tC=rep(tC,"{{PARTNER}}",cx.partner);tC=rep(tC,"{{TITLE}}",cx.title);tC=rep(tC,"{{HOURS}}",cx.hours);tC=rep(tC,"{{TYPE}}",cx.type==="Deg"?"Degree":"Certificate");
main.innerHTML=tC;
var s="";cx.ls.forEach(function(l,i){
var isCp=(i+1)%3===0;
s+="
"+(i+1)+". "+l.t+""+(isCp?"🎯 Quiz":"")+"
";
});
document.getElementById("syl-list").innerHTML=s;
var act=document.getElementById("course-action");
if(usr&&usr.enr[cx.id]){act.innerHTML="Resume Course ➔";}else{
act.innerHTML="";
document.getElementById("b-enr").addEventListener("click",function(){
if(!usr){window.location.href="?cf=login";return;}
usr.enr[cx.id]={prog:0,done:[],cert:null,super_passed:false,final_score:null};localStorage.setItem("cf_user",JSON.stringify(usr));
fetch('/cf-courses-api.php',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({action:'enroll',email:usr.email,name:usr.name,courseId:cx.id})});
window.location.href="?cf=player&id="+cx.id;
});
}
}
else if(view==="player"&&cId){
if(!usr||!usr.enr||!usr.enr[cId]){window.location.href="?cf=dashboard";return;}
var cp=null;DB.forEach(function(x){if(x.id===cId)cp=x;});
if(!cp||!cp.ls||cp.ls.length===0){window.location.href="?cf=dashboard";return;}var en=usr.enr[cId];
if(!en.done) en.done=[];var isSuperQuiz=(lId==="superquiz");
var aL=null;
var curIdx=0;if(!isSuperQuiz){
if(lId){cp.ls.forEach(function(x,i){if(x.id===lId){aL=x;curIdx=i;}});}
if(!aL){aL=cp.ls[0];curIdx=0;}
}var pct=Math.round((en.done.length/cp.ls.length)*100);en.prog=pct;localStorage.setItem("cf_user",JSON.stringify(usr));
var tP=getTpl("player");tP=rep(tP,"{{TITLE}}",cp.title);tP=rep(tP,"{{PCT}}",pct);
main.innerHTML=tP;var maxUnlocked=0;
cp.ls.forEach(function(item, idx){
if(en.done.indexOf(item.id)!==-1 && maxUnlocked===idx){ maxUnlocked=idx+1; }
});var m="";
cp.ls.forEach(function(l,i){
var d=en.done.indexOf(l.id)!==-1;
var isCur=(!isSuperQuiz&&aL.id===l.id);
var isLocked=(i>maxUnlocked);
var isCp=(i+1)%3===0;
var icon=d?"✅":(isLocked?"🔒":(isCp?"🎯":"📖"));
var link=isLocked?"javascript:alert('Complete as aulas e o Quiz anterior para desbloquear.')":("?cf=player&id="+cp.id+"&l="+l.id);
var cls="cf-lesson-link "+(isCur?"cf-active ":"")+(d?"cf-done ":"")+(isLocked?"cf-locked ":"");
m+=""+icon+" "+(i+1)+". "+l.t+"";
});
document.getElementById("pl-menu").innerHTML=m;var allDone=(en.done.length===cp.ls.length);
var sqBtnEl=document.getElementById("pl-superquiz-btn");
if(allDone&&sqBtnEl){
var sqAct=isSuperQuiz?"cf-active ":"";
var sqPassed=en.super_passed?"cf-done ":"";
sqBtnEl.innerHTML="🏆 Super Quiz Final"+(en.super_passed?"✅ "+(en.final_score||100)+"%":"")+"";
}if((en.super_passed||en.prog===100)&&document.getElementById("pl-cert-box")){
document.getElementById("pl-cert-box").innerHTML="🎓 View Certificate";
}var contentEl=document.getElementById("pl-lesson-content");
var actionEl=document.getElementById("pl-action");if(isSuperQuiz){
if(!allDone){
alert("Conclua todas as aulas para liberar o Super Quiz!");
window.location.href="?cf=player&id="+cp.id;
return;
}
var sqData=cp.sq||{passing_score:80, questions:[]};
var sqLockKey="cflock_"+cp.id+"_sq";
var sqSeconds=getLock(sqLockKey);var sqHead="
🏆 Super Quiz Final: "+cp.title+"
Avaliação final do curso. Nota mínima para certificação: "+sqData.passing_score+"%.
";if(sqSeconds>0){
contentEl.innerHTML=sqHead+"
⏳ Período de Revisão Obrigatório
Você não atingiu a nota mínima. Revise as aulas e tente novamente em:
";
actionEl.innerHTML="";
return;
}var sqQuestions=(sqData.questions&&sqData.questions.length)?sqData.questions:[
{q:"Qual é o principal foco prático deste curso?", options:["Aplicação no mercado real", "Apenas memorização teórica", "Nenhum"], answer:0}
];contentEl.innerHTML=sqHead+buildQuizHtml(sqQuestions);
attachQuizEvents(sqQuestions,function(answers){
var cor=0;sqQuestions.forEach(function(q,qi){if(answers[qi]===q.answer)cor++;});
var score=Math.round((cor/sqQuestions.length)*100);
if(score>=sqData.passing_score){
en.super_passed=true;en.final_score=score;localStorage.setItem("cf_user",JSON.stringify(usr));
fetch('/cf-courses-api.php',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({action:'update_progress',email:usr.email,courseId:cp.id,progress:100,score:score})}).then(function(){
alert("🎉 Parabéns! Você atingiu "+score+"% e foi aprovado no Super Quiz!");
window.location.href="?cf=cert&id="+cp.id;
});
}else{
setLock(sqLockKey);
alert("Nota obtida: "+score+"%. Mínima exigida: "+sqData.passing_score+"%.\nVocê poderá tentar novamente em 15 minutos.");
window.location.reload();
}
});
actionEl.innerHTML="";
return;
}var isCp=((curIdx+1)%3===0);
var isDone=(en.done.indexOf(aL.id)!==-1);
var cpData=aL.cp||{passing_score:70, questions:[]};
var cpLockKey="cflock_"+cp.id+"_"+aL.id;
var cpSeconds=getLock(cpLockKey);if(aL.html && aL.html.trim()!==""){
contentEl.innerHTML=aL.html;
}else{
contentEl.innerHTML="
"+(curIdx+1)+". "+aL.t+"
Bem-vindo a esta aula prática da CareersForge Academy.
🎯 Checkpoint Quiz (Aulas "+(curIdx-1)+" a "+(curIdx+1)+")
Nota mínima de corte: "+cpData.passing_score+"%.
"+buildQuizHtml(cpData.questions);
attachQuizEvents(cpData.questions,function(answers){
var cor=0;cpData.questions.forEach(function(q,qi){if(answers[qi]===q.answer)cor++;});
var score=Math.round((cor/cpData.questions.length)*100);
if(score>=cpData.passing_score){
en.done.push(aL.id);localStorage.setItem("cf_user",JSON.stringify(usr));
var nprog=Math.round((en.done.length/cp.ls.length)*100);
fetch('/cf-courses-api.php',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({action:'update_progress',email:usr.email,courseId:cp.id,lesson:aL.id,progress:nprog})}).then(function(){
alert("🎉 Aprovado no Checkpoint com "+score+"%! As próximas aulas foram liberadas.");
window.location.reload();
});
}else{
setLock(cpLockKey);
alert("Nota: "+score+"%. A nota de corte é "+cpData.passing_score+"%.\nRevise as 3 aulas e tente novamente em 15 minutos.");
window.location.reload();
}
});
return;
}if(isDone){
actionEl.innerHTML="
✅ Lesson Completed
";
}else{
actionEl.innerHTML="";
document.getElementById("b-mdone").addEventListener("click",function(){
en.done.push(aL.id);localStorage.setItem("cf_user",JSON.stringify(usr));
var nxt=cp.ls[curIdx+1];
var nprog=Math.round((en.done.length/cp.ls.length)*100);
fetch('/cf-courses-api.php',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({action:'update_progress',email:usr.email,courseId:cp.id,lesson:aL.id,progress:nprog})}).then(function(){
if(nxt){window.location.href="?cf=player&id="+cp.id+"&l="+nxt.id;}
else{window.location.href="?cf=player&id="+cp.id+"&l=superquiz";}
});
});
}
}
else if(view==="cert"&&cId){
if(!usr||!usr.enr||!usr.enr[cId]){window.location.href="?cf=dashboard";return;}
var cc=null;DB.forEach(function(x){if(x.id===cId)cc=x;});
var ec=usr.enr[cId];
if(!ec.cert){ec.cert="CERT-"+Math.random().toString(36).substr(2,8).toUpperCase();localStorage.setItem("cf_user",JSON.stringify(usr));}var certUrl=window.location.origin+"/verify/?id="+ec.cert;
var shareMsg="Concluí com êxito a certificação de "+cc.title+" na CareersForge Academy com aproveitamento de "+(ec.final_score||100)+"%! Confira minha credencial oficial:";
var feedUrl="https://www.linkedin.com/sharing/share-offsite/?url="+encodeURIComponent(certUrl);
var curYear=new Date().getFullYear();
var curMonth=new Date().getMonth()+1;
var licUrl="https://www.linkedin.com/profile/add?startTask=CERTIFICATION_NAME&name="+encodeURIComponent(cc.title)+"&organizationName="+encodeURIComponent("CareersForge")+"&issueYear="+curYear+"&issueMonth="+curMonth+"&certUrl="+encodeURIComponent(certUrl)+"&certId="+encodeURIComponent(ec.cert);var tCe=getTpl("cert");
tCe=rep(tCe,"{{NAME}}",usr.name);
tCe=rep(tCe,"{{TITLE}}",cc.title);
tCe=rep(tCe,"{{GRADE}}",ec.final_score||100);
tCe=rep(tCe,"{{DATE}}",new Date().toLocaleDateString("en-US"));
tCe=rep(tCe,"{{CERTID}}",ec.cert);
tCe=rep(tCe,"{{LINKEDIN_FEED}}",feedUrl);
tCe=rep(tCe,"{{LINKEDIN_LICENSE}}",licUrl);
tCe=rep(tCe,"{{SHARE_TEXT_ENCODED}}",encodeURIComponent(shareMsg+" "+certUrl));
main.innerHTML=tCe;var btnC=document.getElementById("btn-copy-cert");
if(btnC){
btnC.onclick=function(){
navigator.clipboard.writeText(certUrl);
alert("Link do certificado copiado!");
};
}
}
}function buildQuizHtml(questions){
var h="
";
return h;
}function attachQuizEvents(questions,callback){
var ans={};
var btns=document.querySelectorAll(".cf-quiz-opt");
btns.forEach(function(b){
b.addEventListener("click",function(){
var qi=this.getAttribute("data-qi");
var oi=parseInt(this.getAttribute("data-oi"),10);
ans[qi]=oi;
var sibs=document.querySelectorAll(".cf-quiz-opt[data-qi='"+qi+"']");
sibs.forEach(function(s){s.classList.remove("cf-selected");});
this.classList.add("cf-selected");
});
});
document.getElementById("btn-submit-q").addEventListener("click",function(){
if(Object.keys(ans).length!==questions.length){
alert("Responda todas as perguntas antes de enviar.");
return;
}
callback(ans);
});
}function startTimer(elId,sec,onEnd){
if(timerInt) clearInterval(timerInt);
var el=document.getElementById(elId);
function tick(){
if(!el){clearInterval(timerInt);return;}
var m=Math.floor(sec/60);var s=sec%60;
el.innerText=(m<10?"0"+m:m)+":"+(s<10?"0"+s:s);
if(sec<=0){
clearInterval(timerInt);
if(onEnd) onEnd();
}
sec--;
}
tick();
timerInt=setInterval(tick,1000);
}
});
What brings you to CareersForge today?
Select:
91% of learners achieved a positive career outcome
They reported new job opportunities, enhanced skills, and better performance at work after completing a CareersForge certification.
91%
Why learners choose CareersForge
Sarah W.
"CareersForge's reputation for high-quality content allowed me to dive deep into data analysis while managing my daily life."
Noeris B.
"CareersForge restored my confidence and showed me I could dream bigger. It was about believing in my potential again."
Abdullahi M.
"Now I feel much more prepared to take on leadership roles, and I have already started mentoring some of my colleagues."
Anas A.
"Learning with CareersForge expanded my professional experience by giving me access to cutting-edge research and practical tools."
By continuing to browse this site, you agree to our use of cookies.